Add a Permanent Alias to Ubuntu Server 20.04

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.

alias cls=clear

To make it work, we need to reload the bash shell using the following command.

exec -l $SHELL

Success! You're on the list.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.