Using Manual pages#

Introduction to manual pages#

On Unix and Unix-like systems the man command shows a man page, short for manual page, and covers topics like formal standards and conventions, but also computer programs, libraries, and system calls. These man-pages are by default in English but have been translated into many languages over the years. On most systems, the English language is available by default, but to reduce the size of virtual machines the man-pages have to be installed manually with the command below.

Install manual pages on Red Hat based systems#
# yum install man-pages

The man command itself has also a manual page explaining how the command works but also tells which section covers which area. It also gives additional information on how a manual page is structured. Knowing how man works is essential to do your job as a systems administrator or Linux engineer.

Using command man to see the manual page for command man#
$ man man
MAN(1)                        Manual pager utils                        MAN(1)

NAME
    man - an interface to the system reference manuals

SYNOPSIS
    man [man options] [[section] page ...] ...
    man -k [apropos options] regexp ...
    man -K [man options] [section] term ...
    man -f [whatis options] page ...
    man -l [man options] file ...
    man -w|-W [man options] page ...

Manual pages have been divided into sections and the main sections are listed below. Subsections do exist but are most of the time not interesting for end-users to know as they cover legacy systems like the X Windows System, Tcl/Tk, or POSIX specifications.

Section

Description

1

Executable programs or shell commands

2

System calls

3

Library functions, covering, in particular, the C standard library

4

Special files (usually devices, those found in /dev) and drivers

5

File formats and conventions

6

Games and screensavers

7

Miscellaneous

8

System administration commands and daemons

9

Kernel routines

Using the man command#

In the previous example the command man man showed the manual page for man, but this works for other commands supplied by the Linux distribution as well like the passwd command.

Using command man to see the manual page for command passwd#
$ man passwd
PASSWD(1)                       User utilities                       PASSWD(1)

NAME
    passwd - update user's authentication tokens

SYNOPSIS
    passwd  [-k]  [-l]  [-u  [-f]]  [-d] [-e] [-n mindays] [-x maxdays] [-w
    warndays] [-i inactivedays] [-S] [--stdin] [-?] [--usage] [username]

DESCRIPTION
    The passwd utility is used to update user's authentication token(s).
...

With man -k passwd we can see which other pages may exist with the keyword passwd and it lists passwd (1) and passwd (5) beside other pages it has found.

Search for manual pages with option -k#
$ man -k passwd
chgpasswd (8)        - update group passwords in batch mode
chpasswd (8)         - update passwords in batch mode
fgetpwent_r (3)      - get passwd file entry reentrantly
getpwent_r (3)       - get passwd file entry reentrantly
gpasswd (1)          - administer /etc/group and /etc/gshadow
grub2-mkpasswd-pbkdf2 (1) - Generate a PBKDF2 password hash.
htpasswd (1)         - Manage user files for basic authentication
lpasswd (1)          - Change group or user password
mkpasswd (1)         - Overfeatured front end to crypt(3)
openssl-passwd (1ssl) - compute password hashes
pam_localuser (8)    - require users to be listed in /etc/passwd
pam_passwdqc (8)     - Password quality-control PAM module
passwd (1)           - update user's authentication tokens
passwd (5)           - password file
passwd2des (3)       - RFS password encryption
passwdqc.conf (5)    - libpasswdqc configuration file
pwhistory_helper (8) - Helper binary that transfers password hashes from pass...
saslpasswd2 (8)      - set a user's sasl password
smbpasswd (5)        - The Samba encrypted password file
sslpasswd (1ssl)     - compute password hashes
vncpasswd (1)        - change the VNC password

The man command allows to specify the section for the manual page you want to see. By simply adding section 1 before the page on the command line man retrieves the manual page from the Executable programs or shell commands section.

Show manual page for command passwd from section 1#
$ man 1 passwd
PASSWD(1)                       User utilities                       PASSWD(1)

NAME
    passwd - update user's authentication tokens

SYNOPSIS
    passwd  [-k]  [-l]  [-u  [-f]]  [-d] [-e] [-n mindays] [-x maxdays] [-w
    warndays] [-i inactivedays] [-S] [--stdin] [-?] [--usage] [username]

DESCRIPTION
    The passwd utility is used to update user's authentication token(s).
...

When the command is changed to show section 5 the manual page for passwd is also shown, but from the section File formats and conventions, the manual page for the command passwd is shown. Here we see the difference between the two sections and how this manual page explains the file format in which the password hashes are stored.

Show manual page for command passwd from section 5#
$ man 5 passwd
PASSWD(5)                  Linux Programmer's Manual                 PASSWD(5)

NAME
    passwd - password file

DESCRIPTION
    The  /etc/passwd file is a text file that describes user login accounts
    for the system.  It should have read permission allowed for  all  users
    (many  utilities,  like ls(1) use it to map user IDs to usernames), but
    write access only for the superuser.
...

For most new end-users who are still discovering Linux the whatis command is a good starting point. It lists all pages that contain the keyword you specify. The same can be accomplished with man -f <keyword>.

Display one-line manual page descriptions#
$ whatis passwd
passwd (1)           - update user's authentication tokens
openssl-passwd (1ssl) - compute password hashes
passwd (5)           - password file
$ man -f passwd
passwd (1)           - update user's authentication tokens
openssl-passwd (1ssl) - compute password hashes
passwd (5)           - password file

Sometimes keywords aren’t enough and the man can be used to do a global search on all manual pages. With man -K <keyword> it searches and displays all pages that contain the keyword.

Search within keywords with option -K for manual pages#
$ man -K passwd

Alternatives to man command#

The manual page system dates back to the early days of the Unix system written by Dennis Ritchie and Ken Thompson, and has many updates and is available on almost every Unix-based system like Solaris, Linux, FreeBSD, OpenBSD, NetBSD, etc. This means the command below works on most of them the same, but how certain flags are used differs.

Show manual page for tar with command man#
$ man tar

Alternatives do exist as the info system created by the GNU Project.

Show manual page for tar with command info#
$ info tar

Or the curses-based lynx-style info browser.

Show manual page for tar with command pinfo#
$ pinfo tar