Have you ever found something weird on your app when you’re working? Sometimes, it might be because the installation path of your software isn’t listed by the environment apps. But, now you think how could I add the installation path to environment path if I didn’t know the installation path of the app. Thank to ‘which’ command. It is so powerful to figure your app’s installation path.

How to use which

The simplest way to use which command is by following this form:

$ which <applicationname>

For example,

$ which python

in my computer, it results


Theoretically, all app should be installed in /usr/bin folder. But, It does not happen in reality. Some apps are installed in a different location, the others are located in multiple locations.

In my case, this could give the clear example:

$ which roscore

I searched the roscore installation path, which is one of the functions in ROS (Robot Operating System) and found it on


It is not located in /usr/bin folder. So, you need to add it to environment path to be able to use the application.

Some program or application are installed in multiple locations. This can give you a specific example.

$ which nano

It searches for the well-known in-terminal code editor called nano. The which command give this results


which don’t show the whole picture since nano actually located in multiple locations. To show all the available directory we could activate the attribute of ‘which’ command just like this:

$ which -a nano

It returns:


which give the full information of the available place.

Also, you can use ‘which’ to search for multiple programs within the same line of command. For example:

$ which chromium-browser chmod matlab

Returning the following locations:


It is clear enough and so powerful.


‘which’ is a powerful tool to help you find the specific location of your application. The simplest way to use it is by using this form:

$ which

‘which’ can also find the locations of the app that is available in more than one location. It can be used in this form:

$ which -a

Also, It can be used to find multiple applications by using this command:

$ which     . . .

Actually, there is another options to search the location of the file. You can use find command, locate command, or the whereis command which gives use the binary file’s location of the application. Everything is very useful depend on your need.

Thank you for reading this. I hope you find it useful for you. Please comment if you have several questions or you have your own way in how to use ‘which’ command. It seems it would be nice to see below command. Just try it out.

$ which which

Image credits: g-realm.com


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s