Revision as of 13:05, 3 November 2013

In spite of their scope, man pages are designed to be self-contained documents, consequentially limiting themselves to referring to other man pages when discussing related subjects. This is in sharp contrast with the hyperlink-aware info files, GNU's attempt at replacing the traditional man page format.

Man pages are usually referred to by their name, followed by their section number in parentheses. Often there are multiple man pages of the same name, such as man(1) and man(7). In this case, give man the section number followed by the name of the man page, for example:

$ man 5 passwd

to read the man page on /etc/passwd, rather than the passwd utility.

Very brief descriptions of programs can be read out of man pages without displaying the whole page using the whatis command. For example, for a brief description of ls, type:

$ whatis ls

and whatis will output "list directory contents."

포멧

Man pages all follow a fairly standard format, which helps in navigating them. Some sections which are often present include:

NAME - The name of the command and a one-line statement of its purpose.

SYNOPSIS - A list of the options and arguments a command takes or the parameters the function takes and its header file.

DESCRIPTION - A more in depth description of a command or function's purpose and workings.

EXAMPLES - Common examples, usually ranging from the simple to the relatively complex.

OPTIONS - Descriptions of each of the options a command takes and what they do.

EXIT STATUS - The meanings of different exit codes.

FILES - Files related to a command or function.

BUGS - Problems with the command or function that are pending repair. Also known as KNOWN BUGS.

SEE ALSO - A list of related commands or functions.

AUTHOR, HISTORY, COPYRIGHT, LICENSE, WARRANTY - Information about the program, its past, its terms of use, and its creator.

설명서 검색

Whilst the man utility allows users to display man pages, a problem arises when one knows not the exact name of the desired manual page in the first place! Fortunately, the -k or --apropos options can be used to search the manual page descriptions for instances of a given keyword. For example, to search for man pages related to "password":

$ man -k password

or:

$ man --apropos password

This is equivalent to calling the apropos command:

$ apropos password

The given keyword is interpreted as a regular expression by default.

Colored man pages

For some users, color-enabled man pages allow for a clearer presentation and easier digestion of the content. Given that users new to Linux are prone to spend a considerable amount of time familiarizing themselves with basic userspace tools, setting up a comfortable environment is a necessity to most.

There are two prevalent methods for achieving colored man pages: using most, or opting for less. The former is simpler to configure, at the expense of the advanced functionality that is native to less.

Second method: using 'less'

Alternatively, getting an approximate coloured result in manual pages with less is also a possibility. This method has the advantage that less has a bigger feature set than most, and that might be the preference for advanced users.

Add the following to a shell configuration file. For Bash it would be ~/.bashrc: