Online manuals, known as "man pages" (short for manual pages) are the extensive documentation that comes preinstalled with almost all substantial Unix and Unix-like operating systems. The Unix command used to display them is man. Each page is a self-contained document.
- The UNIX help system is based on "Online Manual Pages".
- Many people consider it backwards - you need to know a command's name before you can get help using it.
- This isn't quite true but it's close.
- To get help using a command use the man command with the name of the command. This will show you the manual page for ls:
% man ls
- Usually the manual page is bigger than one screen, so it will be shown using more.
- If you need to get a man page in a particular section, you now need to
specify the section with a -s option.
- For example, SunOS's and Linux's "man 3 printf" becomes "man -s3s printf" (even "man -s3 printf" doesn't work).
- How do you find the section number, you might ask? Well, "man -k" works great.
- You can also use the -a flag (such as "man -a printf") which will show you the man pages for *all* the man pages for that command, regardless of section.
- If you *know* that a certain man page is on the system, but man is refusing to show it, you can use the -F flag. This makes man slower, but tells it to ignore the index files, and search all the man directories directly. This will allow it to find
man pages not in the index. (If you notice this happen, please send mail to cse-consult, so we can update the man page index.)
- The manual page will begin with a line saying something like this. It indicates that the ls manual page is in section 1 of the overall UNIX manuals:
User Commands ls(1)
- Manual sections include:
- 1: user commands
- 2: system calls
- 3: library functions
- 4: file formats
- 5: headers, tables, and macros
- 6: games and demos
- 7: special files
- 9: device driver interfaces
- In BSD, section 8 is for "System Maintenance Commands". But under Solaris, those manual pages got moved to section 1.
- Sometimes the same name has entries in several different sections of the manual.
- man starts searching in section 1 and prints the first manual page it finds matching the name that you provide.
- You can force man to look in a certain section of the manuals
by using the -s "section" flag. For example:
% man -s 2 chown
- This forces man to look for a system call (section 2) named chown instead of a command named chown.
- The rest of the manual page is broken up into sections.
- Typical manual page sections describing commands are:
- NAME: name of command and a brief description of what it does
- SYNOPSIS: show command line syntax for the command
- AVAILABILITY: "package" the command comes in
- DESCRIPTION: more detailed description of what the command does
- OPTIONS: description of what the flags do and what the other command line arguments should be
- ENVIRONMENT: environment variables that effect the command
- FILES: data files or libraries this command uses
- SEE ALSO: other manual pages with related information
- EXAMPLES: examples of use
- NOTES: some extra "tidbits" of information
- BUGS: known bugs
- The SYNOPSIS section has its own characteristic format:
- things inside "[ ]" are optional.
- ... means there can be more than one of the item preceding the dots.
- filename is a generic name for a file - replace this with the name of the file you have.
- things inside "{ }" and separated by "|" mean one of those things is necessary, "|" means "or" so "{+|-|=}" would mean a "+" or a "-" or a "=" character.
- There is a way to check for a manual page by a broader subject.
- The k flag to man does a "keyword search".
- Could search for manual pages that have information about "owner" in them by doing man -k owner.
- man command lists all manual pages it can find related to "owner", can read specific ones to find what you are looking for.
- Usually keyword searches find a lot of entries so it's best to "pipe" output to the more command:
% man -k chown | more
- http://en.wikipedia.org/wiki/Manual_page_%28Unix%29