WriteBash - 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 command
The 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
When working on the system, there are many different versions of the program, which are really useful. Remember it to use.If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.
If you appreciate what we share in this blog, you can support us by:
- Stay connected to: Facebook | Twitter | Google Plus | YouTube
- Subscribe email to recieve new posts from us: Sign up now.
- Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
- Become a Supporter - Make a contribution via PayPal.
- Support us by purchasing Ribbon Lite Child theme being using on this website.
We are thankful for your support.