Ubuntu Custom Command Alias

Aliases are just shortcuts that you can create to replace a long command with a simple one. For example, you could create an alias called add-ppa to replace this command: 
sudo apt-add-repository.



To do that, you need to edit the .bashrc file located in your home directory:

gedit ~/.bashrc

In order to create an alias for this command: sudo apt-add-repository (the command used to add a ppa to your software sources), append the following line to the end of the .bashrc file:

alias add-ppa='sudo apt-add-repository'

Save the file and exit gedit. Next time when you want to add a ppa, just type:

add-ppa PPA-ADDRESS

NOTE: PPA-ADDRESS is the ppa link. It begins with the prefix ppa:. For example, you can use these commands to install Gimp:

add-ppa ppa:otto-kesselgulasch/gimp
sudo apt-get update
sudo apt-get install gimp

The general syntax for creating an alias is:

alias NewCommand='OldCommand' where NewCommand is an alias of your choice and OldCommand is the long command that you want to replace.

Comments