4.3 Command Line Help
4.3.3 Working with man pages
Man Page Headings
There are a number of different headings or informational areas in a typical man page.

The more common ones are:

  • name - Contains the name of the command and other commands that may accomplish the same thing
  • synopsis - Shows the syntax of the command with any allowable options and arguments
  • description - Gives an overview of what the command does
  • operands - The target of the command or what the command will take effect on such as a directory or a file
  • options - Are switches that can change the function or effect of the command. They are normally preceded by a dash (-) or minus sign
  • see also - Refers you to other related commands and subjects Name, Synopsis, Description, Options, Operands and See Also.

These headings are displayed in the man page output using all capital letters. Depending on the command and its purpose, the man page may not contain all headings. For instance, the pwd (Print Working Directory) command does not have an Options or Operands information heading since there are no options or operands that can be used with the command. All commands will have at least a Name, Synopsis and Description.

Man Page
A very common UNIX command is
cd, which allows you to change directories. The results of the man page for the cd command. Note the different headings previously discussed. Some of the output has been omitted since the output from the cd man page is normally about 9 pages long.

Scrolling in Man Pages
The output from some man pages can be as many as 10 to 20 screens of output. Several keys are helpful in moving around in the man utility once the pages for a specific command have been located. Use the following keys to control the scrolling capabilities while using the man command:

Searching Man Pages by Section
As previously discussed, the SEE ALSO part at the bottom of a man page lists alternate references that pertain to the topic addressed. When these references are followed by a number other than 1 in parentheses, it indicates a section of the man pages which can be accessed using the -s option with the man command.


For example, executing $
man passwd will display information on the passwd command and give instructions on how to change a password. The SEE ALSO section of this man page reads in part as follows:

SEE ALSO
finger(1), login(1), nispasswd(1), crypt(3C), passwd(4)

Executing $ man -s 4 passwd will display information on the /etc/passwd file and $ man -s 3C crypt will display information on password encryption. The other SEE ALSO items listed, finger and login, are related but do not have a separate section that can be searched.

Searching Man Pages by Keyword
The -k option for the man command can also be very helpful. As an example, if you know you are looking for a command that has to do with the calendar but are not sure of what commands are available, you can use the -k option to specify a keyword as a subject. Figure shows the results of using the -k option with the man command when looking for commands related to the calendar. 

Displaying Man Page Headers with Whatis
Using the
whatis command will display the header line from the manual section. The man page itself can then be displayed by using the man command. The whatis command can be helpful if you can remember the command name but forget what is does. You can use whatis to get a brief definition of the command. The example shows using whatis to find out what the grep command does (grep will be covered later in the course).

Lab Activity (Adobe Acrobat Reader, 29 kB)
  Using Command Line Help

In this lab, you will work with and access command line help using the man command.  You will use the man pages to determine the use of various UNIX commands and you will work with the man pages and learn to navigate through them.