Understanding Linux Man Pages
Introducing the Man Command
One source of documentation that is generally available on the local system are system manual pages or man pages These pages are shipped as part of the software packages for which they provide documentation, and can be accessed from the command line by using the man command.
The historical Linux Programmer’s Manual, from which man pages originate, was large enough to be multiple printed sections. Each section contains information about a particular topic.
Common Sections of the Linux Manual
SECTION | CONTENT TYPE |
---|---|
1 | User commands (both executable and shell programs) |
2 | System calls (kernel routines invoked from user space) |
3 | Library functions (provided by program libraries) |
4 | Special files (such as device files) |
5 | File formats (for many configuration files and structures) |
6 | Games (historical section for amusing programs) |
7 | Conventions, standards, and miscellaneous (protocols, file systems) |
8 | System administration and privileged commands (maintenance tasks) |
9 | Linux kernel API (internal kernel calls) |
To distinguish identical topic names in different sections, man page references include the section number in parentheses after the topic. For example, passwd(1) describes the command to change passwords, while passwd(5) explains the /etc/passwd file format for storing local user accounts.
To read specific man pages, use man topic. Contents are displayed one screen at a time. The man command searches manual sections in alphanumeric order. For example, man passwd displays passwd(1) by default. To display the man page topic from a specific section, include the section number argument: man 5 passwd displays passwd(5).
Navigate and Search Man Pages
The ability to efficiently search for topics and navigate man pages is a critical administration skill. GUI tools make it easy to configure common system resources, but using the command-line interface is still more efficient. To effectively navigate the command line, you must be able to find the information you need in man pages.
The following table lists basic navigation commands when viewing man pages:
Command | Result |
---|---|
Spacebar | Scroll forward (down) one screen |
PageDown | Scroll forward (down) one screen |
PageUp | Scroll backward (up) one screen |
DownArrow | Scroll forward (down) one line |
UpArrow | Scroll backward (up) one line |
D | Scroll forward (down) one half-screen |
U | Scroll backward (up) one half-screen |
/string | Search forward (down) for string in the man page |
N | Repeat previous search forward (down) in the man page |
Shift+N | Repeat previous search backward (up) in the man page |
G | Go to start of the man page. |
Shift+G | Go to end of the man page. |
Q | Exit man and return to the command shell prompt |
Reading Man Pages
Each topic is separated into several parts. Most topics share the same headings and are presented in the same order. Typically a topic does not feature all headings, because not all headings apply for all topics. Common headings are:
HEADING | DESCRIPTION |
---|---|
NAME | Subject name. Usually a command or file name. Very brief description. |
SYNOPSIS | Summary of the command syntax. |
DESCRIPTION | In-depth description to provide a basic understanding of the topic. |
OPTIONS | Explanation of the command execution options. |
EXAMPLES | Examples of how to use the command, function, or file. |
FILES | A list of files and directories related to the man page. |
SEE ALSO | Related information, normally other man page topics. |
BUGS | Known bugs in the software. |
AUTHOR | Information about who has contributed to the development of the topic. |
Searching for man pages by keyword
A keyword search of man pages is performed with man -k keyword, which displays a list of keyword-matching man page topics with section numbers.
$ man -k passwd
checkPasswdAccess (3) - query the SELinux policy database in the kernel.
chpasswd (8) - update passwords in batch mode
ckpasswd (8) - nnrpd password authenticator
fgetpwent_r (3) - get passwd file entry reentrantly
getpwent_r (3) - get passwd file entry reentrantly
...
passwd (1) - update user's authentication tokens
sslpasswd (1ssl) - compute password hashes
passwd (5) - password file
passwd.nntp (5) - Passwords for connecting to remote NNTP servers
passwd2des (3) - RFS password encryption
...
Popular system administration topics are in sections 1 (user commands), 5 (file formats), and 8 (administrative commands). Administrators using certain troubleshooting tools also use section 2 (system calls). The remaining sections are generally for programmer reference or advanced administration.
IMPORTANT: The man command -K (uppercase) option performs a full-text page search, not just titles and descriptions like the -k option. A full-text search uses greater system resources and take more time.