What is the order in which executables are searched by linux for executing when a command is executed. I have following:
- /bin/play
- /home/prabhat/playframework/play
both the above files are in path.
When I execute it from my home directory as in below
prabhat@localhost~/home/prabhat/$ play
/bin/play gets executed.
What is the order in which linux searches for files to be executed. Is there a way to change it?
The order is defined by the entry order in your PATH variable.
Note that your shell may cache this info and when you change the PATH you may need to refresh this cache. In
bashthis is done by thehashcommand. See here for more information.