Path to an Executable File
Several Unix dialects use the whereis command to find where programs, or executables, are stored in the file structure of the computer. To use it, at the Unix prompt, enter:
whereis command
Replace command with the name of the executable for which you are looking. For example, if you are looking for the location of the lpr command, you would enter:
whereis lpr
The whereis command will return something like the following:
lpr: /usr/ucb/lpr /usr/man/man1/lpr.1
In this example, the above query asked about the lpr command, which spools jobs to printers. The operating system returned two answers, and thus two paths. The first path is where the executable itself actually lives. The second path is the route to the online manual page that gives information about the lpr command.
If you want to know from where in the file structure the operating system executes a command when you enter it on the command line, use the which command instead, for example:
which lpr
This command will output something like the following:
/var/bsd/lpr
This means that if you enter lpr at the command line prompt, the system is really executing /var/bsd/lpr.