2.3. whereis: Finding Where a Command Is LocatedThe 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 cat useless.txt and get the message "cat: command not found," I immediately try whereis cat. This gives me a lot of information about what went wrong: someone may have removed cat (Section 12.2) from the system, or my PATH (Section 35.6) environment variable may be set incorrectly, etc. Output from whereis typically looks like this: % whereis more cat: /bin/cat /usr/share/man/man1/cat.1.gz This says that the executable file is /bin/cat and the manual page is /usr/share/man/man1/cat.1.gz. whereis has a few options worth mentioning:
There are other options for modifying the list of directories through which whereis searches; if you need these, check your manual pages. In addition, the functionality and flags for whereis can differ between versions of Unix. For instance, much of the basic functionality of the command was removed in version 4.4 of FreeBSD as well as Darwin. Again, the manual pages will show you this information. --ML and SP Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|