How to set command alias in Linux?

Printer-friendly versionPDF version

I came from the Windows world and uses cls to clear the terminal screen. So, I wanted to add a global alias for the cls command. To add the alias, you have to make an entry to the .bashrc file in the Home folder.

cd ~
gedit .bashrc

Then to add an alias, add the line given below to the end of the file or between the alias section

alias cls='clear'

Save the file, and open a new terminal window and enjoy your own new cls command. Similarly you can uncomment the ll command in the .bashrc file.

alias ll='ls -l'

No votes yet
mamidicla1977's picture

Usefull post. I bookmark this