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:

-M manpath
The man(1) command searches the directories specified in manpath as well as the standard directories. Manpath is a colon-separated list of directories. The manpath is used instead of the contents of the MANPATH environment variable (if set).
-s section
Look for the man pages in the subdirectory named catsection. By default, man(1) searches through sections named 1 - 9, l (the letter ell, for local), n (for new), and X (for X11 man pages).

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:

-k topic
Search the whatis.db database for a reference-page summary line that contains the keyword topic. The name of the reference page appears in parentheses. The topic can be an extended regular expression; the search is case-insensitive. (Many people prefer to alias man -k to the command apropos(1).)

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 directories containing the formatted reference pages.
The keyword database. This is a text file containing the command summary descriptions from the reference pages, one to a line. For reference pages that document more than one utility or function, parentheses surround the utility or function that designates the page.


The man(1) utility makes use of the following environment variables, if set:

A colon-separated list of directories to search for man pages. Each directory typically contains a set of catsection subdirectories and a whatis.db file.
A command to invoke the pager program that displays the reference page. The default is more