Getting help

Unix provides a help system/command called man, short for manual. The man help system has a large set of manual pages on various topics, such as commands, program library functions, file structures, etc. These have been grouped into general categories.

On our Debian systems, the available manual sections are :

       0   Header files (usually found in /usr/include)
       1   Executable programs or shell commands
       2   System calls (functions provided by the kernel)
       3   Library calls (functions within program libraries)
       4   Special files (usually found in /dev)
       5   File formats and conventions e.g. /etc/passwd
       6   Games
       7   Miscellaneous (including  macro packages and conventions)
       8   System administration commands (usually only for root)
       9   Kernel routines [Non standard]
Overall, this list applies to all Unix systems, but you may find some variation on different versions of Unix. For example, the Solaris system has the separate sections 1m for maintenance commands, 1b for Berkeley versions of some commands, and 1p for POSIX standard commands.

To view a particular topic, invoke man followed by the command or topic to be studied. If one or more man pages for that topic exists, the first and only the first one will be displayed. Because these manual pages can be 100's of lines long, man will use a viewing program specified by the environmental variable PAGER. In most cases, this will be less.

When using less to view a man pages, press h to get help with available commands. When done with the help section, press q to return to the man page being accessed.q to quit less

Some topics are covered by more than one man page. To see which man pages are available for a topic, use -f option. For example :

man -f man


If you wish to view all manual pages for a topic, invoke man with the -a option. The first man page will be displayed. Use q to exit the 1st man-page and [enter] to view the next queued man page.

Although the help for less indicates that you can move between man pages with :n and :p, this will not work when viewing man pages.

However, the following actions are available :

Upon quitting a man page view, if more pages are queued up, a menu will be presented :

  • [enter] - will bring up the next man-page in the queue.

  • [ctrl]-d - skips the next queued man page

  • [ctrl]-c - quits less

    If all pages have been viewed, less closes


    To view a particular man page, use the -S[section] option. For example, the previous man -f man should have listed 3 pages 1, 1p, and 7. To view the POSIX page (1p), try :

    man -f man
    man (7)              - macros to format man pages
    man (1)              - an interface to the on-line reference manuals
    
    man -S 7 man 

    # man page of interest

    You may find that the exact option syntax for retrieving specific man pages varies on different versions of Unix.


    In cases where there is not a specific man page for a topic, you can use the -k (keyword) option. The keyword option will list all man pages that deal with the keyword. This match will be very general and may reference many man pages that are of no interest. The list may run several screens, so you may want to pipe the output to less.

    man -k man | less

    A man page is laid out in a set of standard sections. Not all sections may apply for a particular topic.

    Possible sections :

    NAME - name of the topic covered in the man page and a short description of the topic.

    SYNOPSIS - most often exists if the topic covers a command. It will contain a listing of the command and all the available options or variations of the command.

    DESCRIPTION - is a detailed description of the topic.

    OPTIONS - is a detail description of the available options and their effects. In some cases, DESCRIPTION and OPTIONS are a single section.

    FILES - lists files associated with the topic. For example, the passwd page lists the passwd data file and the shadow data file as related files.

    SEE ALSO - lists other topics related to the current one.

    There may be several other sections, including AUTHOR, BUGS, and EXAMPLES.

    The man command is the original help system developed as part of the Unix system. But with the development of the GNU collection of commands, a second help system, info, has been developed. In general, you will find basic Unix commands are better documented in man, but newer GNU commands or commands that have been tuned for Linux are better documented in info. If you are looking for more than just basic information, always take a peak at the topic in both help systems.

    info - The other help system
    Lectures