Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

How do I make a new command to run a script, for example if I type runme (from any dir) it will run /run/me/ Seems simple but I can find anywhere that explains how to do this :/

share|improve this question
up vote 2 down vote accepted

simply add /run/me to your PATH, any script put there could be simply run from any directory

how to PATH from
To add directory /data/myscripts to the beginning of the $PATH environment variable, use the following:


To add that directory to the end of the path, use the following command:



export PATH

to have it everywhere, all the times, for your user only, add these in place the lines in that user's .bash_profile file
all users except root: add to /etc/profile
for root: only possible by root's .bash_profile

my idea for the sake of laziness (not your case of running 'every' script though): add a symbolic link from a single script there to your /home/usr/loca/bin

share|improve this answer
:) thanks that's what I needed – King Mar 25 '12 at 1:49

Two possiblities:

  1. alias runme='/run/me/' at the bash command prompt. This works for this session only. Put this line in ~/.bashrc if you want this change to be persistent.

  2. rename to runme and add /run/me to the PATH

P.S.: Make sure has executable rights (chmod +x

share|improve this answer
Huh? I need it run from any directory.. My friend has stuff installed on the server in /usr/local/svn/usr/local/bin/ which I run scripts from by typing a_script_in_that_dir , but that is not my home dir, I tried putting a script into there to see if it would work but it didn't :/ – King Mar 25 '12 at 1:01
If you type echo $PATH from the command line you will see all the directories (such as /usr/local/) that the shell looks for programs in. That is one method (#2 above). The other method addresses naming a script one thing, but calling it from the command line as another (aliasing) – Huckle Mar 25 '12 at 4:25

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.