How to Find Where Linux/Mac OS X Commands Are Physically Located?



If you are a beginner it is a good thing to learn about the director/file structures of Linux/Mac OS. It is even better to start learning where the actually commands are located in your machine. You may roughly know that the commands are in some “bin” directory, but not the exact location.

The command “type” can help you to find the exact location of all your favorite commands. Here are a few examples.

>type ls
ls is /bin/ls

The command ls is located at /bin/ls.

To know where whoami is located

type whoami
whoami is /usr/bin/whoami

The command “type” is really versatile. it can find almost anything that you use on the terminal. If you want to know where python is located

>type python
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python

To fins where “latex” is located

type latex
latex is /usr/texbin/latex

Isn’t that cool?