Bash command: which
Most of the commands we have learned about in this class come standard as a part of the Ubuntu distribution we have been using. We will eventually learn about adding new commands and tools to our existing distribution. It is important to know the specific location of a command on your computer, something we can locate easily by using the
which command will give you the absolute path of the file that is being used to execute the instructions.
Let’s find out where the
ls command’s binary lives.
According to the
ls resides in
In Linux when you see something named
bin it is almost always short for the word
binary file is a file that is not readable to humans. Many
binary files are executable programs. In fact, looking into the
/bin directories you may see the names of many executable programs that we have already used in this class!
What about the
which command? It is also an executable command so it should also have a location on our machine. How can we figure out where the
which command resides?
It looks like the which command is also an executable binary located in