Getting Help at the Command Line


As you progress through the chapters in Part IV, you'll likely find yourself wanting to know more about some of the commands and topics covered.

Unlike desktop applications, commands that you type at the command line don't have a Help menu within obvious reach. Don't worry, though; nearly every command in Linux is thoroughly documented using one of the two documentation systems briefly mentioned in the preceding chapter. These documentation systems are manual (man) pages and info pages.

Using Manual Pages: The Basics

The manual page is one of the most fundamental command-line tools in any Linux or Unix system. Manual pages are brief, yet complete, online documents that describe how to use a specific command or system facility.

Linux and Unix operating systems ship with an extensive library of online manual pages. You will find that few commands or system files in a Fedora file system do not have an associated manual page.

You can display manual pages for a given command or facility by using the man command and supplying the name of the manual page you want to read as an argument. To read the manual page for the ls command, for example, type man ls at the command prompt. The manual page for the command appears, as shown in Figure 18.5.

Figure 18.5. After typing man ls, you can see the beginning of the manual page for the ls command.


Each manual page begins with the name of the command, a "manual page section" to which it belongs, and a brief summary of the proper method for calling the command or using the facility in question. The body of the manual page, which contains detailed information, then begins.

The man command always displays a manual page using a pager, a command that displays one screen of text or data at a time. After reading each screen of information, you press the spacebar to proceed to the next screen of information. This way, you can read a manual page slowly, without losing information as it scrolls past the top of the display.

The pager used by the man command is called less. Practice bringing up manual pages for some of the commands you've already learned. To help you navigate manual pages more effectively, Table 18.2 shows some keystrokes understood by the less pager.

Table 18.2. Simple less Navigation for Reading Manual Pages

Key

Action

Spacebar

Displays the next screen full of information

b

Displays the previous screen full of information (moves "backward" one page)

/text

Searches for the next occurrence of text in the manual page you are viewing

q

Quits (closes) this manual page and returns you to the command prompt


Manual Pages Provide a Deeper Look

Command manual pages contain useful information. As you read man pages with less, pay special attention to the many options for altering or enhancing the behavior of most of the commands.


Understanding Manual Page Sections

A typical Linux system holds a large number of manual pages that cover a variety of topics, from common commands to system file formats to various types of system programming information. Because of the number and diversity of manual pages, it is not uncommon to find that a term you're trying to look up might represent more than one kind of item and, hence, more than one manual page. For example, the word passwd represents both a command and a common file format; manual pages exist for both items.

Because a single word can lead to multiple manual pages, the canon of Linux manual pages is divided into numbered sections, somewhat akin to chapters, to help you to differentiate between manual pages of different types. When you use the man command, you have the option of telling man to display pages from a specific section. Table 18.3 shows the manual page sections.

Table 18.3. The Linux Manual Page Sections

Section

Title

Description

1

User Commands

Commands and applications that users commonly call from the Linux command line

2

System Calls

Functions used by programmers to access or control various Linux system facilities

3

Subroutines

Routines used by programmers to access various types of Linux functionality

4

Devices

Information about using various devices and device drivers of which Linux is aware

5

File Formats

Information about the formats of many of the numerous system configuration files in /etc and elsewhere that control the behavior and operation of the Linux operating system

6

Games

Manuals for installed games and entertainment-related commands

7

Miscellaneous

Documentation for various topics that don't appear to easily fit into any of the other sections

8

Administration

Information about commands and concepts related specifically to Linux system administration

L

Local

Documentation that is unique to this Linux system or this version of Linux in particular

N

New

Documentation for additional user-selected, recently installed, or as yet uncategorized commands, files, and concepts


As you might be able to see already, the sections can overlap to some extent, meaning that a command, concept, or file format might appear in a section that you don't initially expect. Each time you use the man command to display documentation, the section from which you are reading appears in the manual page header. For example, examine the first line of output from man ls:

 LS(1)            User Commands              LS(1) 

The (1) in the first line of the manual page indicates that this manual page for ls has been taken from Section 1, User Commands.

The man command normally displays only the first manual page it finds for a given topic. If a topic you want to study occurs in several sectionsfor example, once in user commands and once in file formatsyou see only one of them. If you want to read all the manual pages for a given topic in succession, you must use the -a option:

 [you@workstation20 ~]$ man -a passwd 

As typed, this command lists all the manual pages on file for passwd, in every section. After you press q to exit the first manual page, the second manual page is displayed, and so on.

If you happen to know from past experience or by looking at the section descriptions that you want only the manual page from a particular section, you can specify the section from which you want to read as an argument to man:

 [you@workstation20 ~]$ man 5 passwd 

This command reads only the passwd manual page that resides in Section 5, File Formats.

Read the Manual Page for man

If you want to learn more about using the man command, you can also read its manual page by typing man man at the command prompt.


Locating Manual Pages Through Topic-Based Searches

Our discussion of manual pages thus far assumes that you know which manual pages you want to consult for help. In the real world, this is often not the case: It is common to know that you want help with a particular topic but to find that there is no specific manual page anywhere under that name.

Usually, when this scenario occurs, documentation for the topic in question still exists; it is simply filed under another name or treated as a subtopic in a larger manual page. The apropos command can help you locate manual pages relevant to your topic at the command line.

For example, suppose you want to find manual pages that deal in detail with the concept of Linux directories. You can use the apropos command to help:

 [you@workstation20 ~]$ apropos permissions WWW::RobotRules      (3pm)  - database of robots.txt-derived permissions access               (2)  - check user's permissions for a file acl_clear_perms      (3)  - clear all permissions from an ACL permission set chmod                (1)  - change file access permissions chmod                (2)  - change permissions of a file console.perms [console] (5)  - permissions control file for users at the system console fchmod [chmod]       (2)  - change permissions of a file ioperm               (2)  - set port input/output permissions pam_console          (8)  - control permissions for users at the system console pam_console_apply    (8)  - set or revoke permissions for users at the system console [you@workstation20 ~]$ 

As you can see, apropos supplies a list of manual pages related to the topic of directories, including manual pages for several commands you might already recognize. In the second column, apropos also provides the manual section in which the pages appear, to help you to decide whether the manual page in question will be useful to you. Each manual page is also briefly summarized with a one-line description.

Finding Out What Things Are

A similar command to apropos, whatis might also be useful. Try typing whatis followed by the name of any command or system file in the /etc directory. If a manual page exists for that command or file, details about that page appear.




    SAMS Teach Yourself Red Hat(r) Fedora(tm) 4 Linux(r) All in One
    Cisco ASA and PIX Firewall Handbook
    ISBN: N/A
    EAN: 2147483647
    Year: 2006
    Pages: 311
    Authors: David Hucaby

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net