Surely this is an easy question, that I just don't know how to search for, but if I have two identically named executable files, one in /usr and one in /usr/local (for example), how can I change which one is executed by default without specifying the path, as in /usr/local/file, if $ which returns /usr?

Centos6.4 btw.


1 Answer 1


It's not always as simple as "which comes first in $PATH;" see https://superuser.com/questions/358695/how-does-linux-decide-which-executable-im-trying-to-run. For a quick fix, set an alias in .bashrc (assuming you're using bash...)

alias gorgonzola='usr/local/gorgonzola'

Note: white space is not allowed around the "=" sign.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.