In general, there are many more command line switches available for each command than you have seen so far and certainly more than I have space to include here. If you need to find extra detail about the use and format of anything covered in this book, or any other system facility for that matter, then there is a terrific amount of information available in the form of the on-line manual. Linux has a set of manual pages available that are split into sections. The purpose of the pages in each section is as follows:
This part of the manual details the commands that you type in at the keyboard in response to a shell prompt (such as cat and ls).
When you write programs to be compiled under Linux (in C perhaps), you will often want to call on facilities provided for your programs by the kernel of the operating system. These facilities are accessed via a set of system calls and it is these calls that are detailed in this manual section.
In addition to the system calls provided by the operating system, there is also a huge set of programming language function calls collected into libraries and supplied with the compiler. The library function calls are described in manual section 3.
Under Linux, all input and output is made to look as though is goes to or comes from a file. This means that when you are writing a program to read characters from a keyboard or write characters to a screen or printer, you actually open a file which is one of these devices and read or write characters to it. The files which represent the hardware devices of the machine are special files which are stored, by convention, in /dev. Any special details about driving the hardware through these files is contained in this manual section.
This section describes the structure and layout of various system data and administrative configuration files (the password file, for example).
This is the manual section which describes the games available on the system.
This is a section for miscellaneous items which don't fit anywhere else.
This is another section of commands to type in at the keyboard, but they are only intended to be used for system administration, and usually only by the system privileged user (called root, not to be confused with the directory of the same name).
This section is for descriptions of some of the internal workings of the Linux kernel itself.
$ man ls
This will give a listing of the manual page for the ls command. Because most manual pages are longer than a screen in length, the man command will use the more command (or less) to split its output into screens. Each manual page is split up into several parts. Typically these include:
Under this heading, the name of the manual page entry is given (e.g. ls), along with a one-line description of its function (e.g. list the contents of directories).
This shows how to use the entry, along with a brief list of all the option switches available and a list of any required or optional parameters (e.g ls [-adgilCFR] [name . .]). Anything enclosed in square brackets in these listings is optional and anything followed by ellipses (...) may be repeated. So this example says that is can optionally take any or all of the command line switches adgilCFR optionally followed by one or more names. This matches what you already know about the ls command and adds several more command line switches that you have not yet seen. Indeed, the real version of ls adds more command line switches even than this.
This part gives a much fuller account of the function of the item than the one-liner in the NAME part.
The functionality of each of the switches is now described in detail.
For the manual sections where some kind of function call is being described, this section details the type of value that will be returned. This might also include the specific values returned if any error occurs.
Here, any associated configuration or data files are listed.
This part gives a list of other, related, manual page entries that you might want to look at.
Any known shortcomings or limitations (or even known bugs) are listed here.
Normally, when you ask to see a particular manual entry, the manual is searched sequentially starting with section 1, and it is the first occurrence of the required item which gets displayed. Sometimes, a particular item may occur in more than one manual section. One example of this, which you have already encountered, is the item passwd. This occurs not only in manual section 1 as the passwd command used to change passwords, but also in section 5, where the format of the passwd file in /etc is discussed. If you just enter the command:
$ man passwd
you will always get the section 1 entry if it exists. In order to see the manual entry in a specific manual section you need to give this as an optional parameter to the man command. The following example will list the section 5 passwd entry:
$ man 5 passwd
It is also possible to list any relevant entries in all sections of the manual with the -a switch:
$ man -a passwd