unix which


Example

To determine where on your system an executable in your path exists, use the which command:

$ which python
$

If there is no response, that executable does not exist in your path. The system will simply return you a new prompt without an error message. If the executable does exist on your path, it will show the directory where it actually exists:

$ which ls
/bin/ls

This can be helpful in determining why behavior does not match expectation by ensuring you're executing the version of the executable that you think you are. For instance, if you have both Python 2 and Python 3 installed, they both might be executed by typing python in the terminal - but the executable actually being run may be different than expected. As shown above this command will work for any standard unix command, which are all backed by individual executables.