Remember the different Linux manual sections.
man 1 -> user commands
man 2 -> Linux system calls
man 3 -> C library functions (but not necessarily C Standard Library functions)
man 4 -> special files
man 5 -> file formats
Note: These are the current manual sections. Our textbook uses an
older numbering for manual sections. For example, the book considers
Section 4 to be file formats, but that is now Section 5.
You can get an introduction to section n with the command
$ man n intro
--------------------------------------------------------------------------
Section 3.2
Know the basic ls options, -alFt
man 1 ls
man 1 file
--------------------------------------------------------------------------
Sections 3.4, 3.5
NOTE: An important thing to realize is that the C language and
the C Standard Library have NO way to open directories. Even
though the following functions are in Section 3 of the Linux
man pages, they are not standard C library functions. These
functions, and the relevant headers, are not part of the
C Standard Library. But they do exist, with some system
dependent changes, on most systems, for example GCC on
Windows (MinGW). (I'm not sure about Visual Studio.)
man 3 opendir
man 3 readdir
man 3 seekdir
man 3 closedir
dirent.h
/usr/include/dirent.h
/usr/include/bits/dirent.h
struct dirent
{
__ino64_t d_ino;
unsigned char d_type;
unsigned char __d_unused1[3];
__uint32_t __d_internal1;
char d_name[NAME_MAX + 1];
};
--------------------------------------------------------------------------
Section 3.6
man 1 stat
man 2 stat
sys/stat.h
/usr/include/sys/stat.h
/usr/include/bits/stat.h (struct stat is in here, and it's a conditional compilation mess)
sys/types.h
/usr/include/sys/types.h
--------------------------------------------------------------------------
Section 3.6.7
man 3 getpwuid
man 3 getpwent
man 5 passwd
pwd.h
/etc/passwd (password file)
/usr/include/pwd.h (format for the password file)
--------------------------------------------------------------------------
Section 3.7.1
man 1 passwd
/usr/local/bin/passwd (password command)
/etc/passwd (password file)
--------------------------------------------------------------------------
Section 3.9
Notice how many system calls have user commands with the same name.
man 1 file
man 1 stat
man 2 stat
man 1 chmod
man 2 chmod
man 2 umask
man 1 link
man 2 link
man 1 unlink
man 2 unlink
man 1 chown
man 2 chown
man 1 chgrp
man 1 touch
man 2 utime
man 1 mv
man 2 rename