Section 3.6. Obtaining Online Help: man


[Page 45 (continued)]

3.6. Obtaining Online Help: man

There are bound to be many times when you're at your terminal and you can't quite remember how to use a particular utility. Alternatively, you may know what a utility does, but don't remember what it's called. You may also want to look up an argument not described in this text. Linux systems have a utility called man (short for "manual") which puts this information at your fingertips. man works as shown in Figure 3-3.

Figure 3-3. The man command.

Utility: man [ section ] word

man -k keyword

The manual pages are online copies of the Linux documentation, which is divided into eight or nine sections, depending on your Linux distribution. They contain information about utilities, system calls, file formats, and shells. When man displays help about a given utility, it indicates in which section the entry appears.

The first usage of man displays the manual entry associated with word. If no section number is specified, the first entry that it finds is displayed.

The second usage of man displays a list of all the manual entries that contain keyword.



[Page 46]

The typical division of topics in manual page sections is as follows:

  1. User Commands

  2. System Calls

  3. Library Functions

  4. Special Files

  5. File Formats

  6. Games

  7. Miscellaneous

  8. System Administration and Privileged Commands

  9. Kernel Interfaces (not included in all distributions)

Sometimes, there is more than one manual entry for a particular word. For example, there is a utility called chmod and a system call called chmod (), and there are manual pages for both (in sections 1 and 2). By default, man displays the manual pages for the first entry that it finds, so it will display the manual page for the chmod utility.

Here's an example of man in action:

$ man -k permission    ...search for keyword 'permission'. chmod                (1) - change file access permissions console.perms [console] (5) - permissions control file for users at the system console access               (2) - check user's permissions for a file chmod                (2) - change permissions of a file fchmod [chmod]       (2) - change permissions of a file ioperm               (2) - set port input/output permissions ... q         ...man uses the more command, use 'q' to quit. $ man chmod     ...select the first manual entry. CHMOD(1)             User Commands                  CHMOD(1) NAME        chmod - change file access permissions SYNOPSIS        chmod [OPTIONm]... MODEm[,MODEm]... FILEm...        chmod [OPTIONm]... OCTAL-MODEm FILEm...        chmod [OPTIONm]... --reference=RFILEm FILEm... DESCRIPTION        This manual page documents the GNU version of chmod. ... q $ man 2 chmod    ...select the manual entry from section 2. 
[Page 47]
CHMOD(2) Linux Programmer's Manual CHMOD(2) NAME chmod, fchmod - change permissions of file SYNOPSIS #include <sys/types.h> #include <sys/stat.h> int chmod(const char *path, mode_t mode); int fchmod(int fildes, mode_t mode); DESCRIPTION The mode of the file given by path or referenced by filedes is changed. ... q $ _





Linux for Programmers and Users
Linux for Programmers and Users
ISBN: 0131857487
EAN: 2147483647
Year: 2007
Pages: 339

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