Documentation

Revision / Modified: Apr. 20, 2002
Author: Tom Berger

Original documents:
http://www.mandrakeuser.org/docs/basics/bdoc.html http://www.mandrakeuser.org/docs/basics/bdoc2.html http://www.mandrakeuser.org/docs/basics/bdoc3.html

Overview

Documentation in Linux comes in packages of various sizes, from the mere listing of command line options to complete manuals.

What is...

whatis command

names the program's purpose. It queries the man page database (see below), so it only works if the program has a man page. Example:

whatis rm
rm (1)     - remove files or directories

The number after the command shows which section its man-page is in. Type <q> to leave the summary.

Command line options

Most programs supply a switch offering a short explanation on their usage. Regrettably there's no standard, so you might have to try some switches:

If neither of these work, you have to look elsewhere.

Manuals ('Man' and 'Info' Pages)

Most commands come with either 'man' or 'info' pages:

Try 'man' first since most programs documented in the info format also have a man-page. These can be quite technical, since they are often written by the very people who wrote the program and some programmers are just not very good at writing documentation. ;-) However, they provide the most competent information about how a program works, which options it accepts and sometimes even examples on how to use them.

Docs In 'doc' Directory

Many programs come with additional documentation like README files, FAQs (Frequently Asked Questions) or even user manuals. You can find them in the '/usr/share/doc' directory (pre-7.2: '/usr/doc').

Usually these documents are part of the package you install. There's one notable exception, though, and that's the Linux kernel. You get this very useful collection of documents either if you install the kernel-sources package (then the documentation resides in '/usr/src/linux/Documentation') or by installing the separate kernel-docs package (then it's '/usr/(share)/doc/kernel-docs-[version]').

HOWTOs, FAQs, E-Books

These documents are maintained by members of the Linux Documentation Project (LDP). Some of them are available in languages other than English. The HTML version is usually included in ML (except for 7.0) and located in '/usr/share/doc/HOWTO/other-formats/html/' (pre-7.2: '/usr/doc/HOWTO/[...]'). If you prefer another format (ASCII text, PDF, PostScript), you can download the appropriate package from linuxdoc.
HOWTOs are written by experienced Linux users and currently cover more than 300 topics, like configuring special hardware, setting up and using software, transition from other operating systems, troubleshooting etc. If you don't know how to do something, have a look at them first. Most of them are written in the manner of my pages.
Even if you have the offline version installed, it's a good idea to pay a visit to the online index, since many HOWTOs are updated regularly.

The LDP also maintains other documents, like the guides, which resemble books. They cover broader topics like security, general administration, networking and the Linux kernel. Some of them are written especially with users new to Linux in mind.

A third LDP section contains the FAQ documents with the indispensable, must-read, can't-do-without Linux FAQ. Many (and I mean many) questions on Linux in general and in particular are answered here.

Books

Reading documents on a computer monitor is quite a hard job for your eyes and your mind. Either you print them, or you get yourself some 'real' books. Nowadays there are tons of books on GNU/Linux available, here is a pitiful collection of them:

Distribution Manuals

There are - of course - Mandrake's own manuals, available in English, German, French, Spanish and Italian: The Installation Guide and the User Guide and Reference Manual.
You find a local copy in '/usr/doc/share/mandrake/' after installation, of course it is also accessible via the desktop menu.
Red Hat also provides some excellent documentation in different formats. These are useful for older (pre-7.0) versions of ML: The Red Hat Linux Installation Guide v6.0 and the Red Hat Linux Getting Started Guide v6.0.

More Online Resources

Refer to MUO's Resources section and the Online Troubleshooting Resources HOWTO.

Finding Documentation

If you want to find out which documentation is included in an RPM run:

rpm -qld program_name if the package is already installed or
rpm -qpld package_name if not.

Example:

$ rpm -qld rpm
/usr/share/doc/rpm-4.0/GROUPS
/usr/share/doc/rpm-4.0/RPM-PGP-KEY
/usr/share/man/man8/rpm.8.bz2
/usr/share/man/man8/rpm2cpio.8.bz2

Please refer to the article on RPM if have difficulties with this (e.g. don't know which package a command belongs to).

If you want to load all these documents in a pager for reading, you can do that, too:

less $(rpm -qld rpm)

(This is called command substitution.)

Notice however, that you will have troubles reading HTML or man pages in 'less'. Better use suitable programs for them.

Handling 'man'

Some important command line options are:

man pages use the program 'less' for display. Therefore you can use all navigational shortcuts of 'less' like scrolling with <SPACE> or <RETURN>, bookmarking with <m>, searching forward with /pattern and backward with ?pattern, jumping from pattern to pattern using <n> or <N>. It is important to get used to these, since man pages can be very long. Type <h> in 'less' to get an overview on all available navigational commands.

You can use a lesser form of command line completion with the 'man' command. Type:
man tcl and hit first the <ESC> key and then <!>. The command will be completed to 'man tclsh'.
If the first letters of the man page are ambiguous or if there isn't a man page starting with these letters, nothing happens. This works with info pages, too.

man pages are stored in subdirectories of '/usr/share/man' and other places. As long as a man page is in one of these directories, 'man' will find it by looking at '/etc/man.config'. If you want to read a man page in a non-standard location, you have to supply the path to that file to the 'man' command, or use programs which are capable of rendering the 'man' macro language, like 'mc'.

Handling 'info'

info files provide multi-level manuals which can be browsed by links. These links are marked by an asterisk (*). Put the cursor on one of them and hit <ENTER> to follow this link.
Info pages are organized by 'nodes', i.e. all pages are part of one hierarchical structure. You can display the top of this structure by typing just info.
The most important navigational shortcuts are:

You can also navigate by nodes and levels:

<h> will give you detailed help and <?> a list of available info commands.

Searching Text Files With 'grep'

If you are looking for a string in one or more text files, use 'grep'. 'grep' searches texts for a specific pattern.
Let's say you are searching for files in '/usr/src/linux/Documentation' which contain the string 'magic':

$ grep magic /usr/src/linux/Documentation/*
sysrq.txt:* How do I enable the magic SysRQ key?
sysrq.txt:* How do I use the magic SysRQ key?

The file 'sysrq.txt', among others, contains this string in the context of discussing the SysRQ feature.

By default, 'grep' only searches the current directory. If this directory contains many subdirectories, 'grep' will list them with lines like these:

grep: sound: Is a directory

This can make 'grep's' output quite a nuisance to read. There are two ways to prevent 'grep' from doing this:

If you are expecting a lot of output, you should send it to program like 'less' using a pipe:

$ grep magic /usr/src/linux/Documentation/* | less

Now you can scroll the output conveniently.

An important thing to remember is that you have to provide a file filter (just add * for all files). If you forget this, 'grep' will just wait and thus block the terminal. If this happens to you, press <CTRL c> and try again.

Some of the more interesting command line options for 'grep':

There are also some special signs which help you to refine your search:

Documentation Browsers


Legal: This text is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.