Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I have a script in /home/username/scripts and I would like to execute it by just typing its name.

I know I could do 'export PATH=$PATH:/home/username/scripts' but I would like to have the same effect without having to export the path each time. For instance, if another user was to have a copy of the script they could just type "" instead of "./".

share|improve this question
up vote 6 down vote accepted

Either put it in one of the existing directories in $PATH, or define an alias that points to the appropriate path.

cp /usr/local/bin



The last could be done in every users ~/.bashrc (for the users who need it). Alternatively you could add the PATH to the user's ~/.bash_profile. Possibly changing the default ~/.bash_profile in /etc/skel so new users get this automatically.

If the script should be available for all users, coping it to a system wide PATH, as mentioned above, is the best option.

share|improve this answer
I strongly recommend you to leave your script in your home (/home/username/somewhere) with proper permissions and put a symlink to /usr/local/bin as suggested. This way you will hopefully not forget to backup the script as you will usually backup your home folder. – math Apr 10 '12 at 8:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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