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. Thisreference information is component oriented — in other words, there are sepa- rate man pages for nearly every command, file format, system call, device, andother 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
The -h or --help options are often used to display help messages for a command. The following example illustrates how to display help for the ls command:
$ ls --help| less
Usage: ls [OPTION]...[FILE]...
List information about the FILEs (the current directory by default). Sort entriesalphabetically if none of -cftuSUXnor --sort.
Mandatory arguments to longoptions 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
Theresult shown here is a file named ls.ps that you can open in a PostScriptdocu- ment reader (such as gs) to view the card. (Select View ➪ Rotate Right to view the card properly.) You can use the lpr commandto print the card or, if you don’t usethe--output option, it is sent to your default printer automatically.
Using man Pages
Suppose you want to find man pages for commandsrelated 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/WriteVixie compatible crontab(5) files
crontab (1) - maintain crontabfiles for individual users (ISC Cron
V4.1)
crontab (1p) - schedule periodic background work crontab (5) - tablesfor driving cron (ISC Cron V4.1)
The apropos outputhere shows each man page NAME linethat contains crontab.The number shows the man page sectionin which the man page appears. (We discusssec- tions shortly.)
Thewhatis command is a way to show NAME linesalone for commands that containthe word you enter:
$ whatis cat
cat (1) - concatenate files and print on the standard outputcat (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 - searchfor files in a directory hierarchy
SYNOPSIS
find [-H] [-L] [-P] [path...] [expression]
...
Thepreceding 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 commandand one for the crontab files. Man pagesare 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 followingcode shows some other examples of useful options with the man
command.
$ manmount -a Shows all man pages related to component
$ man5 crontab Shows section 5 manpage for component
$ manmount -P more Use more, not less to page through
$ man-fmount Same as the whatiscommand
$ 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, fileformats, 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 particularcomponent:
$ 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 andEndkeys go to the beginning and end of a node, respectively. Once you are displayingtheinfo 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-coverif you like, the book isdesigned 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, SUSELinux Enterprise, and other SUSE-based Linux systems. In fact, many of the commandsdescribed here are in such widespread use that you could use them exactly as describedhere on most Linux and Unix systems.
0 komentar:
Posting Komentar