Penguin
Note: You are viewing an old revision of this page. View the current version.

Can you think of a REALLY long command that you use on a regular basis? Well if so aliases are for you! :D

Basically an alias is a small command or name to execute a long string. They couldn't be easier to use. At your terminal type:

  • alias <name>='<command to perform>'

so if I do:

  • alias staz='echo you rock Staz'

and then type 'staz' at the terminal, I will be told that I rock :) Of course there are much more useful aliases to be made than the one above :P

Take for example: alias apt='sudo nano /etc/apt/sources.list'

Think about how many times you have edited this file. Wouldn't typing 'apt' be so much nicer?

This alias will only last while you have this terminal window open if you want a permanent one, read on :)

UBUNTU

First we edit your /.bashrc file.

  • sudo nano /.bashrc

Now scroll down to find:

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

Uncomment these three lines (or if they don't exist add them). Now save.

Now do:

  • nano /.bash_aliases

Add all your aliases (in the same format as above) with each being on a separate line. Save when you are done. Good stuff, now reboot and open a terminal. Hopefully your aliases will work like a charm.