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

So I'm here thinking how to create custom commands on my Linux Debian? I mean so I could open up terminal and just type the script name (and possibly some arguments) and it would refer to the script in my home directory. Otherwise I've write the whole path to the script each time and it gets annoying.

share|improve this question
This can be done by setting up Aliases. – paradd0x Apr 29 '11 at 19:44
What shell are you using? – Adam Prax Apr 29 '11 at 19:47
I guess it's bash. – Rihards Apr 29 '11 at 19:50
up vote 5 down vote accepted

You have to add the path of your scripts to PATH, just put in your ~/.bashrc:


where <script-directory-here> is something like /home/you/scripts/.

share|improve this answer
... and add "export PATH" on the next line. – CarlF Apr 29 '11 at 19:56
Thanks guyz, works perfect! – Rihards Apr 29 '11 at 19:59
@CarlF: I never understood the usefulness of export in .bashrc. If you mind a little piece of explanation... – cYrus Apr 29 '11 at 20:08
you could also add a bash alias .. ~/.bash_aliases – farinspace Jul 18 '12 at 20:30
Rather, I would prepend my personal path to the PATH variable, so as to be able to override otherwise existing commands with my own. – gniourf_gniourf Oct 31 '13 at 17:40

Putting your scripts in their own directory, e.g., ~/bin, as cYrus answered, is probably the best solution. Another way to avoid having to "write the whole path to the script each time", though, is to use shortcuts to refer to certain directories. For example, executing


will execute a script named yourscript in the current directory, and


will execute a script in your HOME directory.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .