Thursday, July 09, 2009

How to create a permanent alias

When you frequently need to type the same long command on your terminal, you need to create aliases so you can save time. Unfortunately, when I created a 67 character alias, I didn't know it wouldn't be a permanent one. Having created this alias three times the past few days, I began to suspect it wasn't just an error, but a patern... aliases are not stored by default.

To create permanent aliases, follow this command:
1. Open your ~/.bash_aliases file with text editor you like then add the alias you want. (If you don't have .bash_aliases, create a new one on your home directory).
alias cdvid="cd /home/user/Downloads/Entertainment/Files/Video"

2. Uncomment these 3 lines on your ~/.bashrc file

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases

3. Restart your terminal

And that's it. Now your carefully crafted aliases will be preserved forever..