By Brian Leonard on Feb 10, 2010
The OpenSolaris reference manual (man) pages contain a wealth of information, including much more than just how to use a given command. For example, there's also documentation on file formats, system calls and library functions as well as overview documentation on OpenSolaris technologies like RBAC, SMF and Zones. So getting comfortable with using the man pages will pay dividends.
There are over 19,000 man pages available (which should give you a new appreciation for the amount of work that goes into localizing the system) and they're found based on the MANPATH environment variable. Here's the default setting:
bleonard@os200906:~$ echo $MANPATH /usr/gnu/share/man:/usr/share/man:/usr/X11/share/man
With the bulk of the man pages found under /usr/share/man.
Note, OpenSolaris has it's own version of most, if not all, of the GNU man pages. Generally, since you're probably running the GNU version of these common utilities, you'll probably want to see the GNU version of the man page, which is what you get based on the MATNPATH setting above. However, if you do want to see the OpenSolaris version, you have to specify the path to the man page. For example:
man -M /usr/share/man ls
Another confusing aspect of man pages is that the pages are divided into sections. A good example of this is the pkg command, where you'll often see references to pkg(1) and pkg(5). pkg(1) explains how to use the pkg command while pkg(5) explains the Image Packaging System in general.
There are over 200 different sections, but they roughly break down into the following 9 categories:
1 - User Commands
1M - System Administration Commands
2 - System Calls
3 - Library Functions
4 - File Formats
5 - Standards, Environments, and Macros (general documentation)
6 - Games/Demos
7 - Device and Network Interfaces
8 - Maintenance Procedures
9 - Device Driver Interfaces
If the same man page has multiple sections, you'll be presented with the first man page found starting with section 1, which is generally what you're after (User Commands). So for example, typing man pkg, will return pkg(1). To see the man page for pkg(5), you have to specify the section to the man command as follows:
man -s 5 pkg
Or as Shawn points out in the comments below:
To see all man pages for a given name:
bleonard@os200906:~$ man -l intro intro (1) -M /usr/share/man intro (1m) -M /usr/share/man intro (2) -M /usr/share/man intro (3) -M /usr/share/man intro (7) -M /usr/share/man intro (9) -M /usr/share/man intro (9e) -M /usr/share/man intro (9f) -M /usr/share/man intro (9s) -M /usr/share/man intro (4) -M /usr/share/man intro (5) -M /usr/share/man
Some man pages can be very long, so learning to navigate around is also very beneficial. Some commands that I use frequently:
|| Line forward
|| Page forward
|/<pattern>|| Search forward
|| Find next occurrence
|| Find previous occurrence
|g|| Go to top
|| Go to bottom
Oh yeah, man itself has a man page. So I guess I could have just told you to read the man(1) man page.