Locate the Paths for a Command s Executable, Source Files, and Man Pages


Locate the Paths for a Command's Executable, Source Files, and Man Pages

whereis

The whereis command performs an incredibly useful function: It tells you the paths for a command's executable program, its source files (if they exist), and its man pages. For instance, here's what you might get for KWord, the word processor in the KOffice set of programs (assuming, of course, that the binary, source, and man files are all installed):

[View full width]

$ whereis kword kword: /usr/src/koffice-1.4.1/kword /usr/bin/kword/usr/bin/X11/kword usr/share/man/man1 /kword.1.gz


The whereis command first reports where the source files are: /usr/src/koffice-1.4.1/kword. Then it informs you as to the location of any binary executables: /usr/bin/kword and /usr/bin/X11/kword. KWord is found in two places on this machine, which is a bit unusual but not bizarre. Finally, you find out where the man pages are: /usr/share/man/man1/kword.1.gz. Armed with this information, you can now verify that the program is in fact installed on this computer, and you know now how to run it.

If you want to search only for binaries, use the -b option.

$ whereis -b kword kword: /usr/bin/kword /usr/bin/X11/kword 


If you want to search only for man pages, the -m option is your ticket.

$ whereis -m kword kword: /usr/share/man/man1/kword.1.gz 


Finally, if you want to limit your search only to sources, try the -s option.

$ whereis -s kword kword: /usr/src/koffice-1.4.1/kword 


The whereis command is a good, quick way to find vital information about programs on the computer you're using. You'll find yourself using it more than you think.



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net