which
which
is a command that is used to locate a program in the user’s $PATH
. In fact, which
displays the location of the argument’s executable. In easier-to-understand terminology, which
shows where the tool in question is located in your computer’s file system.
Here is an example of using which
. In this case, we are finding the file location of the pwd
executable:
which pwd
When I run this on my Scholar, I receive the following output:
/usr/bin/pwd
This means that my pwd
executable is stored here: /usr/bin/pwd
which
can be helpful in a number of ways, but is in unlikely that you will need to use it during the semester. However, there are times where more than one version of an executable program is on your machine, and you need to know which you are using. In this case, which
is a tool that can help.