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
gives me a lot of information about what went wrong: someone may have
removed more from the system, or my
environment variable may be set incorrectly, etc.
Output from whereis typically looks like this:
whereis moremore: /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.