How to create bash alias and what is bash alias in linux OS say ubuntu

According to me

Bash alias is used to create your commands in your linux machine as it is to ease or speed up your work.


just edit the file ~/.bashrc by using the below command where in you will see all the bash commands 

 gedit ~/.bashrc

Say as per my previous article I need to clear cache of my application with short commands

alias clr ='sudo rm -rf folder; sudo mkdir folder; sudo chmod 777 -R folder;'

now I added the my commands to my bash  file and i need to let my system use that for me so ill just run the bashrc script file by the command

 

. ~/.bashrc

note: space between the . and ~

Now when you  type "clr" it will do clear the cache, See how much time you saved now.

You can do the same in another way by single command

echo "alias clr='sudo rm -rf folder; sudo mkdir folder; sudo chmod 777 -R folder;'" >> ~/.bashrc; . ~/.bashrc 

Okay Bye. Ill Comeup with my next article to create bash alias functions for dynamic commands. :)