I tend to post quite a lot of Terminal tips. They are useful for adjusting system variables and making changes to your system. They allow you to change things that you would not normally have access to. Sometimes I build and make my own bash scripts, which run in Terminal like a normal command, to get them to run efficiently they are placed in a system folder to allow you to access them by name and not the full path to the scripts location. The problem arises when you forget where the script is located, especially annoying if you want to change it. This command, which is very simple will show you how to find the command you are looking for.
To find where Terminal commands are located open up Terminal and type the following:
which -a xxx
Where xxx is the name of the command. This will search your computer for the allowable install locations for Terminal/bash commands and output the result. The option, -a, will display all of the installed locations, without this option is limiting the usefulness of the command.
For example if you want to find the location of the ssh command used in Terminal you would type the following:
which -a ssh
It will then give you an output similar to the following:
The location of this command is found in the /usr/bin folder. The path is appended with “ssh” name to show which command is actually run. There may be an alias to another command in use.
This trick is useful if you have two commands of the same name, and it is not running the correct program.