This post will show you how to add a permanent command-line alias to a Ubuntu Server 20.04.
To add a permanent alias to a Ubuntu Server 20.04, we need to edit the .bashrc available on any server by default.
To edit the .bashrc, we can use the nano text edit using or VS Code. To use nano, use the following command to edit the .bashrc file.
sudo nano $HOME/.bashrc
Once you open the file with nano, browse to the end of the file, add an alias using the following format, and save the file. In my case, I am adding the alias cls to the clear command.
To make it work, we need to reload the bash shell using the following command.
exec -l $SHELL