Table of Contents
This article will guide you to use the which command to display the executable’s location.
Sometimes, on your system there will be more than one version of the executable program installed.
If you work with the Python language, you will probably understand this.
Syntax of which command
The syntax of that command is quite simple, if you have read the type command then you will have no trouble using that.
$ which commandThe which command starts with the word which and follows the command you want to see, without any additional parameters.
Use which to display an executable’s location
Below, I will perform some examples with the which command. First, I will check the executable file location of the Python command.
Recommended Reading: The command types are in the Linux systems
When working with Python, sometimes you have to use version 2.6, sometimes you have to work with version 2.7 and there are times when you have to work with version 3.5.
And all those Python versions are in your system, now we’ll determine where the executable file is.
trungdung@linuxmint ~ $ which python
/usr/bin/python
trungdung@linuxmint ~ $ which python2
/usr/bin/python2
trungdung@linuxmint ~ $ which python3
/usr/local/bin/python3
Note: which command cannot use to display location of shell bultin or alias commands.
For example, I try to use the which command to view the location of the cd command. You can see it doesn’t return any results. In some other operating systems, you may receive an error message not found.

Conclusion
When working on the system, there are many different versions of the program, which are really useful. Remember it to use.
(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).