[Next] [Previous] [Up] [Top] [Contents] [Index]

Chapter 3: Information Resources

3.1 UNIX On-Line Help

3.1.1 man Pages

On-line help for UNIX system commands and utilities is in the form of man pages (man stands for manual) which consist of an on-line version of the UNIX documentation set (often called the UNIX Programmer's Reference Manual). You access the man pages with the man command.

Note that the man pages differ in many instances between UNIX platforms.

The man Command

When you need help on a known command, use the general man command format:

% man [part] topic 

where topic is generally a UNIX command. man is really the on-line manual which is divided into several parts. part is a digit between 0 and 9. If you know in advance which part contains the information you want, you can speed the search by specifying it. More often than not you will just enter:

% man topic

The word print in man entries usually means display on the screen. Don't be confused by this. Several options are available with the man utility, described under man man. The man command normally displays complete manual pages that you select by name. One-line summaries can be selected by either by keyword (-k option), or by the name of an associated file (-f). These options are described in section 3.1.2.

A typical initial man screen can be seen by issuing the command:

% man ls

where ls is the UNIX command to list files in a directory.

ls(1)                     User Commands                     ls(1)



NAME
     ls - list contents of directory

SYNOPSIS
     ls [ -abcCdfFgilLmnopqrRstux1 ] [ names ]

AVAILABILITY
     SUNWcsu

DESCRIPTION
     For each directory argument, ls lists the  contents  of  the
     directory;  for  each file argument, ls repeats its name and
     any other  information  requested.   The  output  is  sorted
     alphabetically  by  default.  When no argument is given, the
     current directory is listed.   When  several  arguments  are
     given,  the  arguments  are  first sorted appropriately, but
/tmp/mpa002Zf 

Man pages are typically formatted with the UNIX text processing utility nroff (or groff). These utilities are covered in most UNIX texts. If you find that the man page is unformatted, run setup groff, and then rerun the man command.

Note that built-in shell commands are described under the topic corresponding to their shell.[9] (See section 5.1.1 for information on built-in commands.) For example, to get information on the command alias for your current shell, you would enter man shell (e.g., man bash) and search there for information on alias using the /pattern function described below.

There is an alternate, "quick and dirty" method to verify the format of a command and get a listing of its options. It doesn't work with all commands, but is usually worth a try. Simply enter the command with an illegal option (try / or ? or .). For example,

% ls -/

will produce the output:

ls: illegal option -- /
usage: ls -RadCLHxmnlogrtucpFbqisf [files] 

[Missing image]The man Command for AFS Commands

For AFS commands, it works a little differently. AFS commands are discussed in section 7.4. The man page for an AFS command is found by entering:

% man fs_command

[Missing image]Note the underscore (_) between fs and the rest of the AFS command; the underscore is only used with the man command.

Manipulating man Pages

man displays the information using your $PAGER environment variable, which under FUE is set to less (see section 5.4.4). Therefore, man pages are normally piped to less. The command man less will give you more information about manipulating man via the less filter. less gives you one page at a time and lets you enter commands at the prompt to control what it does after each page. For example, you page forward with the Spacebar and page backward using b.

Once in the man environment, you can search for patterns by entering the /pattern option at the command line. The first instance of the string pattern will appear in the top line of the screen. To find additional instances of the pattern in the text, simply enter a slash (/).

To exit from man enter q (for quit).

Printing man Pages

To print a man page, you can use the pipe feature (|) along with recommended print formatting and printing commands. These features are covered in Chapter 8. As a suggestion, pipe the output of the man command to a2ps -m (to convert man pages to PostScript format) and then pipe that output to the print command flpr:

% man command | a2ps -m | flpr [options]

This formats the output nicely in landscape, two pages to a sheet.

3.1.2 Finding the Right Command

If you don't know exactly what command you need, try the -k option with a keyword.

% man -k keyword 

This displays the man page name, the section number in the UNIX documentation, and a short description for each man page whose name line contains keyword. For example to find a search utility, enter:

% man -k search

The system will output several records similar to the following:

conflict(8) - search for alias/password conflicts /usr/local/lib/mh/conflict [-m
glookbib(1) - search bibliographic databases glookbib [ -v ] [ -istring ] [ -tn
ident(1) - identify files ident [ -q ] [ \&.\|.\|. ] ident searches for all occu
lkbib(1) - search bibliographic databases lkbib [ -v ] [ -ifields ] [ -pfilename
lsearch(l) - See if a list contains a particular element lsearch ?mode? list pat
lsearch(n) - See if a list contains a particular element lsearch ?mode? list pat
zgrep(1) - search possibly compressed files for a regular expression zgrep [ gre
..
..

Some UNIX systems have an additional utility, apropos, which can be used to locate commands by keyword lookup:

% apropos keyword 

apropos keyword is equivalent to:

% man -k keyword 

The -f filename option for man prints the manual entry summaries which might pertain to the given filename(s). Any leading pathname components are stripped from the filename before the filename is matched against the summaries. Here is an example using the -f option, followed by the output:

% man -f /etc/passwd 
passwd (1)              - change login password and password attributes
passwd (4)              - password file

The summaries are gotten from the whatis database. You can run whatis command(s) to look up a given command and obtain the header line from the manual section. You can then run man to get more information on the command. If the line starts name(section)... you can do man section name to get the documentation for it.

3.1.3 Vendor Product Documentation

Most vendor product documentation is now available on-line, viewable with an X-terminal or workstation.

Flavor:

Command:

AIX

info

IRIX

insight

Digital UNIX (OSF1)

dxbook

Solaris (SunOS)

answerbook (only usable on Sun workstations at Fermilab)


[9] Some platforms provide man pages for built-in commands, however in general you may find it easier to look in a reference book!

UNIX at Fermilab - 10 Apr 1998

[Next] [Previous] [Up] [Top] [Contents] [Index]