[Chapter 50] 50.5 whereis: Finding Where a Command Is Located
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:56:54Z

#

| Chapter 50 Help--Online Documentation, etc. |

## 50.5 whereis: Finding Where a Command Is Located

The whereis command helps you to locate the executable file, source code, and manual pages for a program. I use it primarily as a sanity check; if I type `more useless.txt`, and get the message "more: command not found," I immediately try `whereis more`. This gives me a lot of information about what went wrong: someone may have removed more from the system, or my PATH (6.4) environment variable may be set incorrectly, etc.

Output from whereis typically looks like this:

>     % whereis more
>     more: /usr/ucb/more /usr/lib/more.help /usr/man/man1/more.1

This says that the executable file is /usr/ucb/more, the command's internal help file is /usr/lib/more.help, and the manual page is /usr/man/man1/more.1.

whereis has a few options worth mentioning. -b says "only report the executable name"; -m says "only report the location of the manual page"; -s means "only search for source files"; and -u says "only issue a report if any of the requested information (executable, manual page, source) is missing."

There are other options for modifying the list of directories through which whereis searches; if you need these, check your manual pages.

- ML

50.4 whatis: One-Line Command Summaries |  | 50.6 Searching Online Manual Pages