Just a quick post on a simple way to add a command alias to your bash terminal. Open up the .bashrc
file in your home directory for editing. I used nano
for this:
nano ~/.bashrc
Next scroll to the very bottom and add a new line. The format of the line is:
alias {name}="{command}"
For example I created a simple alias for the common ping
command by adding the following line to my .bashrc
file.
alias p="ping"
Now I only need to type p
as my command instead of typing out ping
.
This is obviously a very simple example but you can make it as complex as you want. For example you can alias a command with many options to a more simple word saving you a lot of extra typing!
Leave a Reply