# Chapter 2. Getting Help

#### Contents:

The man Command
whatis: One-Line Command Summaries
whereis: Finding Where a Command Is Located
Searching Online Manual Pages
How Unix Systems Remember Their Names
Which Version Am I Using?
What tty Am I On?
Who's On?
The info Command

## 2.1. The man Command

The Unix operating system was one of the first to include online documentation. It's not the best in the world -- most users who haven't internalized the manual set curse it once a week -- but it has proven surprisingly resilient. What's particularly interesting about Unix's online documentation is that, unlike other early help systems, it isn't an adjunct to another set of printed documentation that contains the "real" truth. The online manual is complete, authoritative, and usually more current than any printed documentation.

The basis for Unix's online documentation is the man command. Most simply, you use it as follows:

>     % man topic

where topic is usually the name of some command; but it can also be the name of a system call, a library routine, an I/O device, or an administrative file (or file type). The output from man is usually sent to a pager like more, which allows you to page through the results.

There are several command-line options for the man command that can differ based on system. For instance, to look at a command within a specific section, on a System V machine use the -s "section" option, with the following format:

>     % man section topic
>     % man -s section topic

For example, if you want to read documentation about the /etc/passwd file (rather than the passwd command) on a System V machine, give the command:

>     % man -s 4 passwd

This is an easy way to distinguish between topics with the same name, but in different sections. For other Unix systems, such as FreeBSD, the option to search a section could be something different, such as -S.

Another useful command-line option is the -k option, which is equivalent to the apropos command. This option searches database files for matches of a given keyword, returning the results. This is particularly helpful in finding commands that contain a specific keyword if you're not quite sure what the command is.

Your system may have a configuration file for man named /etc/man.config. If it does, reading it will show you the directories in which manpages are stored, the order in which manpages are searched by default, and more. Even if you don't have an /etc/man.config file, your man command may understand the MANPATH (Section 3.21) environment variable, a list of where man should search. You can set your own MANPATH, for example, to show manpages for local versions of commands before standard versions with the same name.

Your system may also have a different manual page system: info (Section 2.9).

--ML and JP

Copyright © 2003 O'Reilly & Associates. All rights reserved.