Man Pages
Man pages are manuals for commands and other important parts of the system. Take a look at the manual for ls by typing:
$ man ls
Man pages use a pager program (one that allows a user to scroll through output that is longer than the terminal) called less to allow users to read through the text of the man pages. Use Page Up, Page Down, or the up and down arrows to navigate. Use q to return to the command line.
As you can see, this man page wi certain characteristics.
Most of the man pages will have this kind of format. The first is the name, which includes the name of the command and a short description.
Next is a synopsis, which shows the syntax. For ls, this looks like ls [OPTION]... [FILE]... Square brackets mean that a portion of the syntax is optional. Because everything except the ls is optional, ls can be called by itself. The command cp, however, has the following syntax:
cp [OPTION]... [-T] SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...
This means that there are several ways to use this command. The parts not in brackets are required.
Next is the description. This will give a more complete description of the command, as well as additional options for it. Many options come in two forms, short and long. Short options are always one letter and can be combined. They are usually preceded by a single dash (-). Long options are each proceeded by a double dash (--) and cannot be combined. Both types of options can be used in a single command. For example:
$ ls -ab
and:
$ ls --all --escape
and:
$ ls -a --escape
all do the same thing.
The rest will vary, but often it will include information about the author of a program, the licensing details, where to report bugs, and other items related to the topic.
Occasionally, there will be more than one section for a man page. In the ls man page, you'll notice a (1) in the title. Most of the man pages you'll read will be either 1 (user commands), 5 (file formats), or 8 (system commands). The section numbers are as follows:
- User Commands
- System Calls
- Library Functions
- Devices and Device Drivers
- File Formats
- Games
- Miscellaneous
- System Commands
While you'll usually end up with the correct section without specification, one can specify the section: $ man 5 halt shows how to format a file that alters system behavior during shutdown, man 8 halt gives the syntax for the halt command. Many man pages have only one section, but a few will have multiple sections available.
Get used to man pages. They are extremely useful and should be consulted before anything else if you need clarification about a command.
Another source of information is info pages. While not as prolific, they often go into more detail and cover broader concepts than man pages. One good example of this is bash. To access its info entry:
$ info bash