Creating an alias for use on the command line can save the user from typing long commands, common options, or typos. This will save you some time and repetitive keystrokes, and ultimately make your command line experience even more efficient. In this tutorial, we will take you through the step by step instructions to create a permanent alias on a Linux system.
In this tutorial you will learn:
- How to create permanent alias on Linux
- How to use alias on Linux
- How to view configured aliases

Category | Requirements, Conventions or Software Version Used |
---|---|
System | Any Linux distro |
Software | N/A |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
How to create permanent alias on Linux
- To create a permanent alias, we will need to edit the
~/.bashrc
file. You can open this file with nano or your preferred text editor.$ nano ~/.bashrc
- At the bottom of this file, you can add your permanent alias. As an example, we will make a simple alias
docs
which executes the commandcd ~/home/linuxconfig/Documents/
.alias docs='cd /home/linuxconfig/Documents/'
Adding our new alias to the .bashrc file - After saving your changes and exiting the file, execute the following command to make the changes take effect:
$ source ~/.bashrc
- Now we can use our newly configured alias in the command line.
$ docs
Using the new alias in command line - To check your configured aliases, along with the new one you just set, execute this command:
$ alias -p
Viewing the configured aliases on our Linux system
Closing Thoughts
In this tutorial, we saw how to create a permanent alias on a Linux system. As this is a permanent alias, the setting will persist after subsequent reboots. If you need to remove the alias in the future, you will have to delete the line from the
~/.bashrc
file.