|
Seth's Unix Tips |
|
August 21, 2008 |
| ||||||||||||
|
Understanding Manual PagesSYNOPSISNearly every aspect of the UNIX operating system is described in online documentation called "manual pages". But finding the information you need and making sense out of it can be difficult tasks, even for experienced UNIX users. This page offers a basic explanation of how to search for, find, and use manual pages.ORGANIZATIONThe manual pages are typically grouped into eight numbered sections and several lettered sections. The numbered sections are the same on most UNIX systems, but the lettered ones vary. Sections may be further subdivided by appending a letter after the section. For example section 3f might contain Fortran library routines.
USAGEThe basic form for the man command is
The man program searches through manual pages and displays the first page whose name matches topic. Note that there are likely to be multiple man directories and there may be more than one section with an entry matching topic.
To see a listing of all the sections in which topic appears,
use the whatis command:
Some systems use man -f to perform this function:
Usually man page names are followed by a number or letter in parenthesis. That symbol denotes the section of the page. To specify the section in which you wish man to search, add the section symbol to the command line before the topic:
For example
will show you the section 7 page which describes how to create manual pages. Without the section designation, you would get the section 1 page which describes the man command itself. Each page has a summary line as well as a name. If you aren't sure of the name, you can search those summary lines for a keyword. This is the first step to finding a page whose name you don't know. To do a keyword search, use the -k option:
There is no way to directly tell man how to resolve the ambiguity of a name which appears in the same section in two different directories. It will simply take whichever one appears first in the MANPATH environment variable or its own internal search path. This situation usually occurs when there is a local installation superceding a standard command. For example, my site runs a perl version of the man program which has its manual page in /usr/local/man/man1 while the page for the standard program is in /usr/man/man1. For more information on how man decides which page to show, see the man (1) manual page.
MovementOnce man finds and formats the manual page you specified, it passes the result to a paging program which actually displays it. Most systems default to using the more command. Within more, the space bar will move you forward one page. You can search for a keyword by typing a slash "/" followed by the keyword. The "n" key repeats the last search. See the more manual page for more information. More enlightened systems use the less command for paging, which has many extra features including the ability to scroll up and down the page. Check for a less man page if your system supports its use. If you are on an X Windows compatible display, you can also look for xman or tkman for graphical interfaces.FORMATNow that you know what manual pages are, there is the all important matter of understanding how to read them. This can be a tricky task and many people give up in frustration. The most important thing to remember about manual pages is don't give up. Even if you don't understand most of what is being said, at least skim through the whole thing. As you will see on my sample manual page, the most useful information often appears at the end of the page.
See Also
BUGSIf you are unfortunate enough to be using Solaris 2.x you will find that the manual pages are organized differently and that the man command works differently. Most notably, many of the sections are physically divided into subsections by one letter extensions. You must specify a page's exact subsection in order to find it (Solaris 2.x does not allow you to cover an entire section).
The man command itself requires a "-s" switch to specify
the section:
For example,
Finds the nanosleep function of the realtime library.
|
| Seth B. Noble | Wednesday, September 07, 2005 | sbnoble@DataExpedition.com | 877-292-2280 |