Dec 23, 2025
Viktoras D.
5min Read
The Linux alias command lets you create shortcuts for longer or multiple commands, making your command line usage more efficient and user-friendly for executing complex commands more quickly.
In this guide, you’ll learn how to create temporary and permanent aliases in Linux and how to manage and remove them. You’ll also see practical examples you can start using right away.
A Linux alias is a bash alias command that replaces a longer command with a custom command to simplify command-line usage.
alias ll='ls -la'
When you run a command like ll, the shell interprets the alias and substitutes it with ls -la before executing it. This substitution happens at the shell level, so the alias never reaches the system as-is. Aliases are expanded early in the command evaluation process, before functions, built-in commands, and external commands.
This makes them a fast and convenient way to reduce repetitive typing and avoid mistakes in the terminal.
The general form of the alias command is:
alias name='command'
Quoting the command is important, especially when it contains spaces or special characters. Without quotes, the shell can misinterpret parts of the command, like in this example:
alias ll=ls -la
This treats only ls as the alias value and tries to run -la as a separate command, which will fail. In this case, the correct syntax would be:
alias ll='ls -la'
This practice is essential in the shell configuration file to avoid errors. Note that aliases are case-sensitive, so ll and LL would be treated as different names.
The alias command itself has limited options, but here are the key ones:
These alias command options let you define, manage, or remove Linux aliases easily, whether you’re using a single alias or managing multiple options.
A temporary alias in Linux exists only for the current terminal session and disappears once you close the terminal. In contrast, permanent aliases are saved in configuration files and automatically loaded when you start a new shell. Here’s how to create an alias in Linux using the following syntax:
alias diskspace='df -m'
diskspace
Add an alias to your shell configuration file to make it permanent across terminal sessions. After that, reload the file or restart the terminal to apply the change. Here’s where to place aliases based on your shell:
| Shell | Configuration file | Reload command |
| Bash | ~/.bashrc | source ~/.bashrc |
| Zsh | ~/.zshrc | source ~/.zshrc |
| Sh | ~/.profile | source ~/.profile |
You can add a new alias by appending it to the appropriate file. For example, use the echo command to append the alias definition:
echo "alias diskspace='df -m'" >> ~/.bashrc source ~/.bashrc
And in Zsh:
echo "alias diskspace='df -m'" >> ~/.zshrc source ~/.zshrc
Running source reloads the configuration file immediately without restarting the terminal. Alternatively, you can close and reopen the terminal to load the changes.
Storing aliases in a separate file allows you to better manage the Linux alias command across user environments. Per-user aliases go into your shell config files like .bashrc or .zshrc. If you want the alias available to all users, place it in a script under /etc/profile.d/.
Be careful when aliasing critical commands like rm, shutdown, or reboot in shared environments. Avoid creating aliases that obscure or alter the behavior of important system tools unless the intent is clearly communicated.
Warning! Files in /etc/profile.d/*.sh are executed for all users. Adding aliases here affects everyone on the system. Use caution and avoid adding anything user-specific or insecure.
To view all currently defined aliases in your session, run:
alias
This will display all the aliases in the format alias name=’command’. For a script-friendly output, use:
alias -p
This is helpful if you’re exporting aliases or using them in scripts, since it outputs in a plain format without color or formatting that could interfere with parsing.
Many Linux distributions, like Ubuntu or Fedora, come with preconfigured aliases by default. These often include colored versions of commands like ls or grep to improve readability in the terminal.
To remove a specific alias from your current session, use the unalias command followed by the alias name:
unalias diskspace
Use the following command to verify whether the alias or a command with the same name exists:
type -a diskspace
If the alias is gone and no command with that name exists, type -a will return “not found.”
If you want to remove every alias currently defined in your session, use:
unalias -a
The unalias command removes all the defined aliases created using the alias command, including those loaded from the bashrc file. It does not delete permanent aliases. When you open a new terminal, those saved aliases will load again unless removed from the config file.
Here are useful aliases, each one a practical example, you can add to speed up your workflow:
Navigation
Safety
Git
Docker/Kubernetes
System updates

Aliases are one of the simplest ways to improve Linux shell shortcuts and work faster. The shell expands the alias before executing the underlying command. As a result, you can create quick, customizable shortcuts that cut down on typing, help you avoid repeating the same command, and reduce mistakes.
Start by creating Linux aliases for commonly used commands in your Linux system to reduce repetition and streamline your terminal session. The more repetitive or complex the command, the more benefit you’ll get from turning it into a shortcut.
Remember, temporary aliases are great for quick fixes, but for anything you use regularly, add a permanent alias to your shell configuration file so it loads automatically in every session.
You’ve learned how to create aliases, make them permanent, remove them when needed, and apply them to tools like Git, Docker, and system navigation. Over time, you’ll build a cleaner, faster, and more efficient command line environment, saving valuable free time during daily operations.