Because Linux provides so many commands and because
Linux commands provide so many possible options, you can't
expect to recall all of them. To help you, Linux provides
the
man command and the
apropos command, which let you access a
help database that describes each command and its
options.
Each Linux command is described by a special file
called a
manual page. The manual
pages are stored in a group of subdirectories comprising a
help database. To access this database, you use the
man command, which resembles the MS-DOS
help command. For example, to get help
on using the
w command, type:
root@desktop:/root#
man w
Figure 4.1 shows the resulting
output, which the command displays one page at a
time. Notice the colon prompt, which appears at the bottom
left of the screen. To page forward, press the
Space key; to page backward, press
the
b key. To exit the
man program, press the
q key.
The manual pages are organized according to a common
format. At the beginning of a manual page, you'll find the
name of the page and the section of the manual page
database from which the page comes, shown in
parentheses. For example, the figure shows the manual page
named
w, which comes from section 1 of
the manual page database.
Table 4.1
describes the sections of the manual page database; most
sections are primarily of interest to programmers. As a
user and administrator, you'll be interested primarily in
sections 1 and 8.
Table 4.1: Manual Page
Sections
Section |
Description |
1 |
Executable programs and
shell commands |
2 |
System calls (provided
by the kernel) |
3 |
Library calls (provided
by system libraries) |
4 |
Special files (for
example, device files) |
5 |
File formats and
conventions |
6 |
Games |
7 |
Macro packages and
conventions |
8 |
System administration
commands |
9 |
Non-standard kernel
routines |
Next in the output comes the name and brief
description of the command. Then comes a synopsis of the
command, which shows the options and arguments that you
can specify. Brackets enclose parts of a command that you
can choose to include or omit. Next comes a detailed
description of the operation of the command, followed by a
description of its options.
As you're learning your way around Linux, you may find
it convenient to reserve a virtual console for running the
man command. That way, you can enter
commands in a separate virtual console, switching between
consoles to refresh your recollection of the options and
arguments of commands as you type them.
The
man command searches the manual
pages and displays detailed information about a specified
command. The
apropos command also
searches the manual pages; however, it displays summary
information about manual pages that contain a specified
keyword. (The search is limited to the short description
that appears at the beginning of each manual page). For
example, typing the command:
root@desktop:/root#
apropos files
displays a list of manual pages that contain the word
files, as shown in
Figure 4.2.
The
apropos command is useful when
you don't recall the name of a Linux command. By typing a
related keyword, you can obtain a list of commands and
search the list for the command you need.