Most every command on your system has an associated ``man'' page. This is documentation that you can get to instantly should you have questions or problems. If you were having trouble with the command ls, you could enter man ls. This will bring up the man page for ls. The man page is viewed through the less program, so all of the options to less will work while in a man page. Some important key strokes are:
Sometimes viewing man pages isn't too friendly on line. Providing you have a working printer, you can print man pages as well. If you don't have postscript printing capability and just want to print ASCII, you can print man pages with:
man COMMAND | groff -mandoc -Tascii | lpr
If you do have a postscript printer, you will probably want to print with:
man COMMAND | groff -mandoc | lpr
In both of those commands substitute ``COMMAND'' for the command you are trying to get help for.
Also, sometimes things have more than one man page. Here is a table of what is located where:
Section Contents ------- ---------------- 1 user commands 2 system calls 3 library calls 4 devices 5 file formats 6 games 7 miscellaneous 8 system commands 9 kernel internals
So, let's say that you want to see the man page for swapon. You do man swapon. You will actually get the man page for the system call swapon(2), which is the function you use in a C program to turn swap on. Unless you are writing your own program to do it, this probably isn't what you want. So, using the chart above, you can see that what you want is probably a ``system command'' and is located in section 8. You can then do man 8 swapon. All of this is because man searches the man directories in order, and then returns when it finds the first match.
You can also search the man pages for strings. You do this using man -k string_to_search_for. This won't work, however, unless the makewhatis database has been created. Under Red Hat Linux, this is done by a cron job overnight. If you don't leave your system running overnight the database won't get created. If that is the case, just run:
/usr/sbin/makewhatis /usr/man /usr/X11R6/man
Note: This must be done as root.
Once you've done that, you could enter man -k swapon. That command would return:
# man -k swapon swapon, swapoff (2) - start/stop swapping to file/device swapon, swapoff (8) - enable/disable devices and files for paging and swapping
So you can see that there are pages in section 2 and 8 both referring to swapon (and swapoff in this case).