These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX01/Entering Commands II

Classnotes | UNIX01 | RecentChanges | Preferences

Showing revision 1

Basic Commands : Documentation and Viewers

We will now examine some of the basic commands with respect to online documentation and file browsers/viewers. There are many more beyond these, but what will be presented here will be the essentials.

man

After "ls", "man" is the second command you should be most familier with. "man" is a "Manual Page" viewer for UNIX and is crucial in finding help for unknown or little-known commands and programs.

A "Manual Page" or "man page" is a document that gives an overview and usage information for a given program or command. On an ideally setup UNIX system every command and program will have an associated man page, although this is rarely the case in practice. Most often, your UNIX or Linux system will have the majority of the commands and programs documented in man pages, with a minority of them undocumented. If your UNIX is setup properly, the undocumented programs will return some sort of system-wide "undocumented" man-page to indicate it. On UNIX systems whic are not setup properly, undocumented programs will simply return an error when the man page is requested.

A man page will look roughly like this:

Each man page is broken down into several sections. Some of the more common sections are as follows:

    • NAME: This lists the name of program or command.
    • SYNOPSIS: This is the general usage of the program or command.
    • DESCRIPTION: This is the detailed description of the command.
    • OPTIONS: This is usually where command line options go.
    • AUTHORS: This lists who wrote the program and how to contact them.
    • BUGS: This will contain known bugs or problems with the program.
    • SEE ALSO: This gives you other locations or man pages to check for references.

While you are viewing a man page, you can press the up and down arrows to navigate, as well as Page Up and Page Down (provided you have keymapping properly set up... some older UNIXes do not do this). You may also use the traditional "SPACE" for page down and "B" for page up (these herald from the days when Page Up and Page Down were not properly mapped). To exit the man page viewer, press "Q" for quit.

To look up a man page on command, simply issue a man command. For example, if I wanted to view the man page for "cp", I would issue:

 $ man cp

If I wanted the man page for "man", I would issue:

 $ man man

Sometimes, there are multiple man pages for a given command or program. This is usually the case when a particular program also has a programming library interface. For example, "pipe" is both a Postfix MTA program and a C function call for creating pipes under Linux.

Because there may be multiple man pages for a given command or program, the man pages are divided up into different sections, numbered 1-9:

 1   Executable programs or shell commands
 2   System calls (functions provided by the kernel)
 3   Library calls (functions within system libraries)
 4   Special files (usually found in /dev)
 5   File formats and conventions eg /etc/passwd
 6   Games
 7   Miscellaneous (including macro  packages  and  conven-
     tions), e.g. man(7), groff(7)
 8   System administration commands (usually only for root)
 9   Kernel routines [Non standard]

For example, if I wanted to read the man page for "pipe", the Postfix MTA program which is in section #8, I would issue:

 $ man 8 pipe

If I wished to read the man page for "pipe", the system C library call, I would issue:

 $ man 2 pipe


Classnotes | UNIX01 | RecentChanges | Preferences
This page is read-only | View other revisions | View current revision
Edited July 12, 2003 4:54 am (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.