e

Creating Aliases

To make your life easier and reduce the amount of commands you have to type, you can use aliases!

Open a Terminal and type:

leafpad .bashrc 

Once .bashrc opens in leafpad, scroll to the bottom of the document and add

# My Aliases

Next its time to add aliases. you have to add them each on their own line below the my aliases comment you just added. Don't forget to save your file after you're done adding aliases. Remember you will have to open a new Terminal to use your new aliases.

The correct syntax for creating aliases is:

alias youralias =' the command to execute '

So for example:

alias get='sudo apt-get install'

In Terminal you just type: get firefox and due to this alias the cli will execute sudo apt-get install firefox.

One more example:

alias remove='sudo apt-get remove'

In Terminal you just type: remove firefox and this will execute the following command: sudo apt-get remove firefox.

If you use an alias with the same name as a bash command or program installed on your system, the alias will take precedent over the standard bash command when used. Therefore you stand a risk of breaking other bash commands! This is easily repaired by removing/changing the alias in .bashrc

User Feedback

aliases
Did you find this article helpful?
Yes, right on the money!
 
100%(11)
Somewhat. Needs work.
0%(0)
Not really
0%(0)
Not at all.
0%(0)

If you would like to comment or make further suggestions, please leave a note on our Comments page (you will have to Create an Account if you haven't already).

 
aliases.txt · Last modified: 2011/11/08 13:50 by rbtylee · [Old revisions]


© Copyright Bodhi Linux 2012. All Rights Reserved - Hosted by vaultnetworks