Main index

Introducing UNIX and Linux


Getting started

Overview
Using UNIX
      Usernames
      Logging in
Logging out
Commands
      Typing in commands
      Commands and options
Communication with other users
      Email
      Other communication facilities
Files
      The editor Vi
            Vi commands (command mode)
            Vi commands (colon mode)
      Other editors
Input and output
      Scripts
      Here-documents
      Pipes
      Making copies of input and output
      Pagers
Emergencies
Getting help
Summary
Exercises

Getting help

There is an on-line help facility available on UNIX systems. It goes under the name of manual pages, and the command to get help is man (followed by the topic you require assistance with). The manual pages give very detailed information about UNIX commands, and may appear intimidating at first - the manual 'page' for the C compiler cc often runs to 20 or more screens of text. As an example, if we require more information on the command who, we might get:

man who

WHO(1)                                        WHO(1)

NAME
       who - show who is logged on

SYNOPSIS
       who [-mTu]

DESCRIPTION
       If given no arguments, who prints the following
       information for each user currently logged on:

         login name     terminal line       login time

OPTIONS
        ...

Do not panic! Although the format looks a bit strange, each manual page is structured in the same way. First of all, on the top line is the name of the command followed in parentheses by a number - the manual pages are divided into volumes, usually numbered 1 to 8 inclusive. We are concerned principally with commands in volume 1, which are commands you can type in to the shell. Other volumes give information on other UNIX utilities, such as libraries available to language compilers. The top line may also tell you who wrote the utility, and when it was last updated. There then follows a sequence of headers (such as NAME) and information under those headings:

NAME The name of the command, and a short description
SYNOPSIS The arguments (if any) it expects
DESCRIPTION A detailed description of the command
OPTIONS A list of the possible options, and what they do
FILES The files used by the command
SEE ALSO Related topics or commands with manual pages
DIAGNOSTICS What to do if the command fails
NOTES Miscellaneous other useful information

Remember that UNIX commands are usually (though not always) lower-case, and that if you type them upper-case by mistake, the machine will not understand you. In the example of who above, under the heading SYNOPSIS, we have:

who [ -mTu ]

The square brackets indicate that options -m, -T and -u are optional and can be typed in any order and combination. For the meanings of the options and arguments, look further down the manual page.

Worked example

Find out how to display the current hardware type on which your system is running by using uname.
Solution: By typing man uname we get:

UNAME(1)                                    UNAME(1)

NAME
       uname - print system information

SYNOPSIS
       uname [-amnrsv]

DESCRIPTION
                       ...
OPTIONS
       -m       Print the name of the hardware type
                 on which the system is running.
                       ...

and thus the command you require is uname -m (machine).

If you are unsure which (if any) command you can use to perform a particular task, type man -k followed by a keyword related to that task. You will be given a brief (1-line) description of all commands indexed by that keyword, and can then select which command you would like detailed information on. You can only give man one keyword at a time, so if the first keyword you try doesn't indicate a suitable command, try a couple of others.

Worked example

You wish to find who else is logged in; which command can you use?
Solution: Use man -k; choose a single keyword relevant to the topic, say logged:

man -k logged
who (1)        - show who is logged on

So you should use command who.

The division of UNIX manual pages into volumes is not part of the POSIX standard, nor is the exact format of a manual page that we describe here.


Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck