Setting up Command Aliases in Linux

Aliases are a great way to run a command or script from the command window without having to either remember, or type everything in each time. This example is for the bash shell…

Open the file ~/.bashrc for editing:

vi ~/.bashrc

Add a new alias at the bottom of the file, for example:

alias connectServer='ssh -lusername'

Then install the .bashrc to make it available:

source ~/.bashrc

Now you can just type the name of the alias in the command window and it will perform the action defined in the .bashrc file:


Leave a Reply

Your email address will not be published. Required fields are marked *