home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 50.4 whatis: One-Line Command Summaries Chapter 50
Help--Online Documentation, etc.
Next: 50.6 Searching Online Manual Pages
 

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


Previous: 50.4 whatis: One-Line Command Summaries UNIX Power Tools Next: 50.6 Searching Online Manual Pages
50.4 whatis: One-Line Command Summaries Book Index 50.6 Searching Online Manual Pages

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System