Creating Command Aliases In Ubuntu for the command line interface

About

Aliases can be used in place of longer or more complicated commands so that you run the alias command instead of the longer or more complicated commands and it does the same thing without having to type them out. These aliases will only work for your user account on the linux machine. If you login as another use, they won’t work.

Instructions

First edit the .bashrc file

sudo vim ~.bashrc

Go down to the bottom and add a commented line

#Aliases

Underneath that you can put your alias. If you want to create additional aliases, make a new line under the previous and create another alias.

alias cool="sudo apt update"

Save the .bashrc file changes in vim

Reload the .bashrc file via command line with the following command

. ~/.bashrc

So now if you type “cool” in terminal and press enter then that ‘sudo apt update’ command will run.