- Find Out About Commands with man
- Search for a Command Based on What It Does
- Quickly Find Out What a Command Does Based on Its Name
- Rebuild man's Database of Commands
- Read a Command's Specific Man Page
- Print Man Pages
- Learn About Commands with info
- Navigate Within info
- Locate the Paths for a Command's Executable, Source Files, and Man Pages
- Read Descriptions of Commands
- Find a Command Based on What It Does
- Find Out Which Version of a Command Will Run
- Conclusion
Read a Command's Specific Man Page
man [1-8]
You might notice in the previous listing that the first line of man's page on ls references LS(1), while earlier, when you used the -k option, all the names of commands were also followed by numbers in parentheses. Most of them are 1, but one, lsof, is 8. So what's up with all of these numbers?
The answer is that man pages are categorized into various sections, numbered from 1 to 8, which break down as follows (and don't worry if you don't recognize some of the example, as many of them are pretty arcane and specialized):
- General commands. Examples are cd, chmod, lp, mkdir, and passwd.
- Low-level system calls provided by the kernel. Examples are intro and chmod.
- C library functions. Examples are beep, HTML::Parser, and Mail::Internet.
- Special files, such as devices found in /dev. Examples are console, lp, and mouse.
- File formats and conventions. Examples are apt.conf, dpkg.cfg, hosts, and passwd.
- Games. Examples are atlantik, bouncingcow, kmahjongg, and rubik.
- Miscellanea, including macro packages. Examples are ascii, samba, and utf-8.
- System administration commands used by root. Examples are mount and shutdown.
Almost every command we've looked at so far in this book falls into section 1, which isn't surprising because we're focused on general use of your Linux system. But notice how some commands fall into more than one section: chmod, for instance, is in both 1 and 2, while passwd can be found in 1 and 5. By default, if you enter man passwd in your shell, man defaults to the lower number, so you'll get the section 1 man page for passwd, which isn't very helpful if you want to learn about the file passwd. To see the man page for the file passwd, follow man with the section number for the data you want to examine.
$ man passwd PASSWD(1) PASSWD(1) NAME passwd - change user password SYNOPSIS passwd [-f|-s] [name] passwd [-g] [-r|-R] group passwd [-x max] [-n min] [-w warn] [-i inact] login passwd {-l|-u|-d|-S|-e} login DESCRIPTION passwd changes passwords for user and group accounts. A normal user... [Listing condensed due to length] $ man 5 passwd PASSWD(5) PASSWD(5) NAME passwd - The password file DESCRIPTION passwd contains various pieces of information for each user account. [Listing condensed due to length]