Create a file name .bash_aliases in home directory
Then when we need to create a alias open that file in text editor(in my case: Gedit) with root privileges.
sudo gedit ~/.bash_aliases
then create whatever alias you want inside the text file
eg:
alias update="sudo apt-get update"
and save the text file.
as you may have noticed I assigned “update” to “sudo apt-get update”
now whenever I type in the command ‘Update’ on to the terminal it will run “sudo apt-get update”
In the latest versions of Ubuntu, ~/.bashrc
automatically sources ~/.bash_aliases
, so permanent aliases are best put into this file instead. previously we used to put permanent aliases on ~/.bashrc