Getting Help with man
Occasionally, you may need a bit of help remembering what a particular command does. Using man (which is short for "manual"), you can look up information about commands and get pointers for using them efficiently. Figure 1.9 shows a Unix help page (also called a man page, for obvious reasons) for passwords. In the following steps, we'll show you how to look up specific Unix commands and find related topics.
Figure 1.9. Using man passwd, you can access the standard man file about the passwd program.
To access a man page:
At the prompt, type man plus the name of the command you want help with (in this case, passwd). You'll get the man page for that command. Use the and (for Back) to navigate through the file, just as you do with more.
To find a specific man page:
man -k passwd
Type man -k plus the name of the command or the topic you want help with (in this case, passwd). As Code Listing 1.9 shows, you'll see a list of possible man pages, command names, man page names, and a description. Note the man page name (and number if more than one page with the same name exists) so you can reference it in the next step.
Code Listing 1.9. man -k passwd gives you these results, showing specific password-related man pages.
$ man -k passwd chpasswd (8) - update password file in batch gpasswd (1) - administer the /etc/group file mkpasswd (1) - generate new password, optionally apply it to a user mkpasswd (8) - Update passwd and group database files passwd (1) - update a user's authentication tokens(s) passwd (5) - password file userpasswd (1) - A graphical tool to allow users to change their passwords $
man 5 passwd
Here, you type man, the man page you want to view (indicated by 5 in this case to specify section 5this is necessary because more than one man page with the name passwd was listed in the last step), and the command name (passwd). Figure 1.9 shows the resulting man page.
You can make a copy of a man page so you can edit it or comment on it, adding additional notes for your information or deleting irrelevant (to you) stuff. Just type in man command name | col b -x > somefilename. For example, use man passwd | col b x > ~/my.password.command.notes to make a copy of the passwd man page, sans formatting, in your home directory, under the name my.password.command.notes. Then you'll use an editor (from Chapter 4) to edit, add to, and tweak the important points. (The col b -x command fixes some formatting oddities; without it, all of the underlined words show up as _u_n_d_e_r_l_i_n_e.)
You can use apropos instead of the mank flag. For example, you might use this:apropos passwd
Some Unix systems might require a -s before the section number, as in man -s 5 passwd