Create Alias In Linux
In linux to create alias or shortcut of any command we use alias command. We will create alias for ls -ltr command. Which will list all the contents of directory in list format in reverse order.
[email protected]:~# alias list=ls -ltr
Above command will create alias name listso whenever you type it will list all contents of directory.
But this alias is valid in this terminal session only. To create permanent alias we have to make changes in .bashrc file. Navigate to your home directory using command
[email protected]:~# cd ~
Now open .bashrc file using any editor like nanoor vicommand you will see file something like that
Now write command after comment some more aliases
alias list=ls -ltr
and save and quit. Then reload .bashrc file using command
[email protected]:~# source .bashrc
now your alias is available in any terminal and in multiple session just type listin terminal it will show output same as ls -ltr.