Howto Create your own aliases in Debian
Posted by Admin on January 5th, 2009
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
First, edit your ~/.bashrc
#vi ~/.bashrc
and make sure that it contains the following three lines (if not add them editing the file)
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
After this all you have to do is edit your ~/.bash_aliases file and add your own aliases.
#vi ~/.bash_aliases
Examples
alias dld=’cd ~/downloads’
alias x11=’nano /etc/X11/XF86Config-4′
alias pak=’cd /var/cache/apt/archives’
Save and exit the file.
In the above examples, “dld”, “x11″ and “pak” commands will execute the exact command from the right side of the equal sign.


January 5th, 2009 at 10:34 pm
Why bother with the extra file, just put the aliases directly in the ~/.bashrc file.
January 6th, 2009 at 9:35 pm
Excellent, now when I type urnar instead of unrar it still works!
Thanks
January 8th, 2009 at 11:38 am
@Wolfric:
Have a look at the ZSH instead of Bash. It has a autocorrection feature… Happy mistyping
January 8th, 2009 at 7:51 pm
I suppose everyone who can edit files using VI can already set aliases in .bashrc
January 15th, 2009 at 5:34 pm
Totally insane to use aliases for cd, IMHO
Why not use the CDPATH variable instead.
eg.
CDPATH=.:/var/cache/apt:~/
now “cd archives” will look in current dir, then /var/cache/apt, and ~/
February 5th, 2009 at 4:32 pm
Automake fails when using bash and CDPATH is set. If you’re a developer or build your programs from source it can be annoying sitting there for a few minutes until you remember the build is failing because the CDPATH environment variable is set. I’m not sure if that bug has been fixed yet.
IMO, the best and safest solution is to either use tab completion or learn how to type.