The command man is the most important command in the
Unix system: it brings up the online documentation which detail every command available on the
system. The most basic syntax for the command is
man command
This will display the documentation for command using
the Unix more command, which
displays
the file one screen at a time (about ten lines.) To scroll through the
documentation you use basic man commands:
key | action |
SPACE | display next screen of text |
b | skip backward one screen of text |
DOWN_ARROW | move down one line |
UP_ARROW | move up one line |
p | go back to the beginning of the document |
/pattern | search for next occurrence of pattern |
/ | search for next occurrence of last pattern entered |
q | quit |
Each page of the manual contains the documentation for an item (Unix command,
system call, system information) and is called a manpage or title page. And each manpage is divided
into several sections. In the
usual
order
of occurrence
these are:
Section | Contents |
NAME | the name of the command and a brief description of its action |
SYNOPSIS | the syntax of the command: for Unix commands this is the command line form for C functions this includes all header files needed as well as the function prototype |
DESCRIPTION | detailed description of the action of the function, each argument, and the return value of the action |
ERRORS | a list of each value that errno might be set as well as the cause of the error |
SEE ALSO | other related manpage entries as well as their location in the manpage |
HISTORY | A brief account of where the function arose. |
The manual is also divided into eight or nine sections. This is very important to keep in mind: some
commands may occur in several sections. For example, open
occurs as both a Unix command as well as a system call, and these occur in separate
sections. A simple call
man
open
will only display the Unix command, since it occurs earlier in the manual then the manpage for the
system call. If a command or function has a title in the manpage documentation, this will be listed
in paratheses: open(1) or
open(2).
Section Number | Description |
1 | Executable programs which can be executed on the command line. |
2 | System calls provided by the kernel. |
3 | Library calls for programmers. |
4 | Special files for device drivers and network interfaces. |
5 | File formats and conventions (e.g. /etc/passwd) |
6 | Game documentation |
7 | Miscellaneous documentation such as ASCII tables |
8 | System administration commands for a privileged user |
9 | Kernel routines |
Finally, you too can add entries to the manual pages (there is nothing sacrosanct about them!!!) Have a look at the manual page for man and see if you can figure-out how to call-up a manual page documenting one of your own functions.