Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Feb 24 '10 at 4:07

This question came from our site for professional and enthusiast programmers.

All directories listed in $PATH are searched for executables.

share|improve this answer

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/

share|improve this answer
It'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 Feb 24 '10 at 5:25

The search path for binaries is stored in an environment variable, PATH

You can inspect the current value:

[steven@scstop:~]% echo $PATH


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

share|improve this answer

Modify your $PATH environment variable in your profile to include /myname/local/bin. eg export PATH="/myname/local/bin:$PATH"

share|improve this answer

You must log in to answer this question.