Friday, February 15, 2013

Linux: showing full path of command

Q: Did you ever face the problem that you used the command that just worked for you, but you didn't have any idea where the script itself is located?
A: Life is simple here, just use command: which.

As an example, imagine you'd like to find out where the famous cp command is located, you'd run (included with the output in my case as well):
which cp
/usr/bin/cp
now you know :)

This is really powerful mostly for those scripts with multiple versions present on the system. To ensure you use the correct one.

If interested in full power, check the man page: http://www.linuxmanpages.com/man1/which.1.php

No comments: