Next Up Previous Contents Index

7.1 On Line Help

On Line Help

When you are looking for general help on commands and error messages, the best place to start is right on your system.

7.1.1 Man Pages

Man Pages

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 | lpr

If you do have a postscript printer, you will probably want to print with:

man -t COMMAND | 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, run the following command as the root user:

/etc/cron.weekly/makewhatis.cron

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).

7.1.2 Package Documentation

Package Documentation

Many packages of software have README files and other documentation as part of the source package. Red Hat Linux uses a standard place to install those documents so that you don't have to install the sources to look at the documents. All of those documents are stored in subdirectories of /usr/doc. The subdirectory depends on the package. Each package that has extra documentation will create a directory called packagename-version-releasenumber. For example, the tin package might be version 1.22 and release number 2. The path to its documentation would be /usr/doc/tin-1.22-2.

For the most part, the documents in this directory are ASCII. You can usually view them with more filename or less filename. This is nice, but what if you want to see if there is documentation for a specific command or file and you don't know the package it came from? It doesn't matter! You can simply enter:

rpm -qdf /etc/sendmail.cf

This will report all the documentation from the package containing the file
/etc/sendmail.cf. Commands like this are covered more in depth in the RPM-HOWTO , available from www.redhat.com.

Also, what if it's a command you need help with and the man page isn't good? You could do something like:

rpm -qdf `which COMMAND`

Again, ``COMMAND'' is the actual command you need help with. This will work only when the command is on your path.

7.1.3 HOWTOs and FAQs

HOWTOs and FAQs

Most of the contents of the Linux Documentation Project (LDP) are available in /usr/doc on your system.

/usr/doc/HOWTO contains the ASCII versions of all the available HOWTOs at the time we pressed the CD-ROM. They are gzipped, so you have to use gunzip to unzip them or use a command like:

zcat HAM-HOWTO.gz | more

The latter will work, but is a bit less flexible than unzipping and then using more. However, unzipping also requires more disk space unless you re-gzip the document when done.

/usr/doc/HOWTO/mini contains the ASCII versions of all the available mini-HOWTOs. They are not compressed and can be viewed with more or less. /usr/doc/HTML contains the HTML versions of all the HOWTOs and the Linux Installation and Getting Started guide. To view things here, just use a WWW browser like redbaron from Red Hat Software, or arena . You would do something like:

cd /usr/doc/HTML
arena index.html

/usr/doc/FAQ contains ASCII version (and some HTML versions) of some popular FAQs, including the RedHat-FAQ. All of them can be viewed using more or less.

7.1.4 The ``locate'' Command

The ``locate'' Command

When you don't know the full name of a command or file, but need to find it, you can usually find it with locate. locate uses a database to find all files on your system. Normally, this database gets built from a cron job every night. This won't happen, however, if your machine isn't booted into Linux all the time. So, if that is the case, you may occasionally want to run the following command:

/etc/cron.daily/updatedb.cron

You will need to be root on your system when doing that. That will allow locate to work properly.

So, if you know you need to find all the ``finger'' files, you could run:

locate finger

It should return something like:

/usr/bin/finger
/usr/lib/irc/script/finger
/usr/man/man1/finger.1
/usr/man/man8/in.fingerd.8
/usr/sbin/in.fingerd

One thing to note, however, is that locate not only returns hits based on file name, but also on path name. So if you have a /home/djb/finger/ directory on your system, it would get returned along with all files in the directory.

7.1.5 ``info'' Pages

``info'' Pages

While man is the most ubiquitous documentation format, info is much more powerful. It provides hypertext links to make reading large documents much easier and many features for the documentation writer. There are some very complete info documents on various aspects of Red Hat (especially the portions from the GNU project).

To read info documentation, use the info program without any arguments. It will present you with a list of available documentation. If it can't find something, it's probably because you don't have the package installed that includes that documentation. Install it with RPM and try again.

If you're comfortable using emacs, it has a built in browser for info documentation. Use [Ctrl-h] [Ctrl-i] to see it.

The info system is a hypertext based system. Any highlighted text that appears is a link leading to more information. Use [Tab] to move the cursor to the link, and press [Enter] to follow the link. Pressing [p] returns you to the previous page, [n] moves you to the next page, and [u] goes up one level of documentation. To exit info, press [Ctrl-x] [Ctrl-c] (control-x followed by control-c).

The best way to learn how to use info is to read the info documentation on it. If you read the first screen that info presents you'll be able to get started.


Next Up Previous Contents Index