How to Use Man Pages in UNIX/Linux
Using Online Documentation
The Linux/UNIX OS provides online manual pages, which describe commands and their usage. Additionally, online help resources provide general desktop information.
Displaying the Online Manual Pages
The online UNIX Reference Manual (man) pages provide detailed descriptions of UNIX commands and how to use them. Use the man command to display the man page entry that explains a given command.
The syntax of the man command is:
$ man command $ man option command $ man option filename
For example, to display the man pages for the uname command, perform the command:
$ man uname Reformatting page. Please Wait... done User Commands uname(1) NAME uname - print name of current system SYNOPSIS uname [ -aimnprsvX ] uname [ -S system_name ] DESCRIPTION The uname utility prints information about the current sys tem on the standard output. When options are specified, sym bols representing one or more system characteristics will be written to the standard output. If no options are specified, uname prints the current operating system’s name. The options print selected information returned by uname(2), sysinfo(2), or both. ... (output truncated)
Scrolling in Man Pages
Table below shows the keys on the keyboard that you use to control the scrolling capabilities when you are in the man pages.
|Space bar||Displays the next screen of a man page|
|Return||Displays the next line of a man page|
|b||Moves back one full screen|
|/pattern||Searches forward for a pattern|
|n||Finds the next occurrence of a pattern after you have used /pattern|
|h||Provides a description of all scrolling capabilities|
|q||Quits the man command|
Searching the Man Pages
Two ways to search for information in the man pages are searching by section or by keyword.
Searching Man Pages by Section
You can search within a speciﬁc section of the man pages by using the man command with the -s option. The online man-page entries are organized into sections based on the type or use of the command or ﬁle. For example, Section 1 contains user commands, while Section 4 contains information about various ﬁle formats.
You can use the man intro command to view descriptive information about sections contained in the man pages. The syntax for looking up a speciﬁc section of the man pages is the man command with the -s option, followed by the section number, and the command or ﬁle name.
$ man -s number command or $ man -s number filename
The last section of a man page, titled SEE ALSO, lists other commands or ﬁles related to the man page. The number in parentheses reﬂects the section where the man page is located. You can use the man command with the -l option to list the man pages that relate to the same command or ﬁle name.
The following example shows the SEE ALSO part of the man page for passwd(1). Note that there is also a man page entry for passwd in Section 4.
SEE ALSO finger(1), login(1), nispasswd(1), nistbladm(1), yppasswd(1), domainname(1M), eeprom(1M), id(1M), passmgmt(1M), pwconv(1M), su(1M), useradd(1M), userdel(1M), usermod(1M), crypt(3C), getpwnam(3C), getspnam(3C), getusershell(3C), nis_local_directory(3N), pam(3), loginlog(4), nsswitch.conf(4), pam.conf( 4), passwd(4), shadow(4), attributes(5), environ(5), pam_unix(5) ... (output truncated)
To view the online man page for the passwd ﬁle information, perform the following commands:
$man -l passwd passwd (1) -M /usr/man passwd (4) -M /usr/man
$ man -s 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] [username] DESCRIPTION The passwd utility is used to update user's authentication token(s). This task is achieved through calls to the Linux-PAM and Libuser API. Essentially, it initializes itself as a "passwd" service with Linux-PAM and utilizes configured password modules to authenticate and then update a user's password. A simple entry in the global Linux-PAM configuration file for this service would be:
Searching Man Pages by Keyword
When you are not sure of the name of a command, you can search for man page entries that are related by using the man command with the -k option and a keyword. The man command output provides a list of commands and descriptions that contain the keyword. The syntax for using the command to conduct a keyword search is:
man -k keyword
To view commands containing the keyword calendar, perform the command:
$ man -k calendar ... (output truncated) cal cal (1) - display a calendar calendar calendar (1) - reminder service difftime difftime (3c) - computes the difference between two calendar times mktime mktime (3c) - converts a tm structure to a calendar time