man - display system documentation
man [-M manpaths] [-s section] name ...
man section name ...
man -k topic
The man(1) command displays information about the given command or function name. If both a system interface call and a command have the same name (such as printf(1) and printf(3)), you can indicate which one you want by specifying a section name with -s section (or, in the second form, section).
The options are:
Section 1 is utilities; section 2 is calls traditionally implemented as system calls; section 3 is library routines.
Section | Contents |
---|---|
1 | Commands and utilities |
2 | "System calls" |
3 | Library routines |
4 | Devices and drivers |
5 | File formats and other miscellaneous information |
In the preceding table, the term "system calls" is placed in quotation marks because these calls are traditionally associated with the kernel. Because the Interix application programming interface (API) is not in the kernel itself, but in the subsystem, calls to it are not really system calls.
The man(1) command displays the first matching reference page it finds.
The section numbers are used to distinguish between reference pages with the same names, such as printf(1) and printf(3). To see the reference page for the printf(1) utility, use the command:
$ man -s 1 printf
and to see the reference page for the printf(3) function, use:
$ man -s 3 printf
You can also use man(1) to look for commands and calls related to a particular topic. The -k option searches for a particular keyword:
The whatis.db database is the collection of utility and function descriptions found under the NAME headings of the reference pages.
To find all programs for editing files:
$ man -k edit
ed - line oriented text editor
ex, vi - Visual editor
sed - stream editor
To see the reference page for the printf(3) function:
$ man 3 printf
The man(1) command exits with 0 for success and >0 for failure. It returns 1 if the topic is not found in any "whatis" database.
The man(1) utility uses the following files and directories:
The man(1) utility makes use of the following environment variables, if set:
grep(1)
more(1)