Original Linux and Unix documentation was all done on manual pages,
generally referred to as man pages. A slightly
more sophisticated documentation effort came a bit later with the info facility. Within
each command itself, help messages are
almost always available. This
reference information is component oriented — in other words, there are sepa- rate man pages for nearly every command, file format, system call, device, and
other component of a Linux system. Documentation more closely aligned to whole software packages is typically stored in a subdirectory of the /usr/share/doc directory. All three reference
features — man pages, info
documents, and help messages — are
available in SUSE and openSUSE.
Using help Messages
$ ls --help
| less
Usage: ls [OPTION]...
[FILE]...
List information about the FILEs (the current
directory by
default). Sort entries
alphabetically if none
of -cftuSUX
nor --sort.
Mandatory arguments to long
options are mandatory for short options.
-a, --all do
not hide entries starting with .
-A, --almost-all do not list implied . and ..
...
The preceding output
shows how the ls command line is used and
lists available options. Piping the output to the less command lets you page through
it. You can format the help messages into a reference card using the card command. For example:
$ card
ls --output=/tmp/ls.ps
$ lpr ls.ps
The
result shown here is a file named ls.ps that you can open in a PostScript
docu- ment reader (such as gs) to view the card. (Select View ➪ Rotate Right to view the card properly.) You can use the lpr command
to print the card or, if you don’t use
the
--output option, it is sent to your default printer automatically.
Using man Pages
Suppose you want to find man pages for commands
related to a certain word. Use the apropos command to search the man page database.
This shows man pages that have crontab in the man page NAME line:
$ apropos crontab
Config::Crontab (3pm) - Read/Write
Vixie compatible crontab(5) files
crontab (1) - maintain crontab
files for individual users
(ISC Cron
V4.1)
crontab (1p) - schedule periodic
background
work crontab (5) - tables
for driving cron (ISC
Cron V4.1)
The apropos output
here shows each man page NAME line
that contains crontab.
The number shows the man page section
in which the man page appears. (We discuss
sec- tions shortly.)
The
whatis command is a way to show NAME lines
alone for commands that contain
the word you enter:
$ whatis cat
cat (1) - concatenate files and
print on the standard output
cat (1p) - concatenate and print files
The easiest way to display the man page for a term is with the man command and the com- mand name. For example:
$ man find
FIND(1) FIND(1) NAME
find - search
for files in a directory hierarchy
SYNOPSIS
find [-H] [-L] [-P] [path...] [expression]
...
The
preceding command displays the first man page found for the find command.
As you saw in the earlier example, some terms have multiple man pages. For example, there is a man page for the crontab command
and one for the crontab files. Man pages
are organized into sections, as shown in Table 1-2.
Table 1-2: man Page Sections
Section Description
|
0 Header files (usually found in /usr/include)
|
1 Executable
programs or shell commands
|
2 System
calls
|
3 Library
calls
|
4 Special
files
|
5 File
formats and conventions
|
6 Games
|
7 Miscellaneous
|
8 System
administration commands
|
9 Kernel routines [Non standard]
|
The following
code shows some other examples of useful options with the man
command.
$ man
mount -a Shows all man pages related to component
$ man
5 crontab Shows section 5 man
page for component
$ man
mount -P more Use
more, not less to page through
$ man
-f
mount Same
as the whatis
command
$ man
-k mount Same as the apropos command
Man pages are
also available on the Internet. A nicely organized
reference site is
Using info Documents
In some cases, developers have put more complete descriptions of commands, file
formats, devices, or other Linux components in the info database. You can enter the info database by simply typing the info command or by opening a particular
component:
$
info ls
The previous command shows information on the ls command. Use up, down, left and right arrows and Page Up and Page Down to move around the screen. Home and
End
keys go to the beginning and end of a node, respectively. Once you are displaying
the
info screen, you can get around using the keystrokes shown in Table 1-3.
Table 1-3: Moving through the info Screen
Keystroke Movement
|
? Display
the basic commands to use in info windows.
|
Shift+l Go back to
the previous node you were viewing.
|
n, p, u Go to the node that is next, previous, or up, respectively.
|
Tab Go to the next hyperlink
that is in this node.
|
Enter Go to the
hyperlink that is under the cursor.
|
Shift+r Follow a cross reference.
|
Shift+q or q Quit and exit from info.
|
Software packages that
have particularly extensive text available in the info database include gimp,
festival, libc, automake, zsh, sed, tar,
and bash. Files used by the info database are
stored in the /usr/share/info directory.
Summary
While you certainly can read this book from cover-to-cover
if you like, the book is
designed to be a reference to hundreds of features in SUSE Linux that are most useful to power users and systems administrators. Because information is organized by topic,
instead of alphabetically, you don’t
have to know the commands in advance to find what you need to get the job done.
Most of the features described in this book will work equally well in openSUSE, SUSE
Linux Enterprise, and other SUSE-based Linux systems. In fact, many of the commands
described here are in such widespread use that you could use them exactly as described
here on most Linux and Unix systems.
No comments:
Post a Comment