Linux: Which command

The “which” command will reveal the absolute path of the executable file called when issuing a command.

The linux which command is useful in determining if you may need to add a path to your $PATH variable in your ~/.profile file in order to be able to issue the command.


promt$>which php
/usr/bin/php

promt$>which wget
/usr/bin/wget

The above example echos out the path. It is possible that there are more than one pathh to the executable file in the $PATH variable.
If you want to echo out ALL the paths in the $PATH variable, then use the -a flag (option)

Leave a Reply

Your email address will not be published. Required fields are marked *