4
For example, any binary placed in /usr/local/bin
will run in any location. If I were to place binaries inside /myname/local/bin
how would I be able to accomplish the same thing?
4
For example, any binary placed in /usr/local/bin
will run in any location. If I were to place binaries inside /myname/local/bin
how would I be able to accomplish the same thing?
8
All directories listed in $PATH
are searched for executables.
4
To enable your custom path by default you can add:
export PATH="/myname/local/bin:$PATH"
at the bottom of your ~/.bashrc
(for user only) or /etc/profile
(for all system users) or any new file like /etc/profile.d/mypath.sh
1
The search path for binaries is stored in an environment variable, PATH
You can inspect the current value:
[steven@scstop:~]% echo $PATH
/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Note how it's a colon separated list of directories. When you type "mybinary" at the prompt, your shell will go through these directories (in order) and execute the first one it finds.
To add /myname/local/bin to the PATH, do this (in a bash-like shell)
export PATH=$PATH:/myname/local/bin
0
Modify your $PATH environment variable in your profile to include /myname/local/bin
.
eg export PATH="/myname/local/bin:$PATH"
1It's a good idea to put your custom path after the default one unless you want to override default behavior. export PATH="$PATH:/myname/local/bin" – Chris Nava – 2010-02-24T05:25:42.470