Alias Frequently Used Commands in Linux

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

What is an Alias?

An alias is a custom shortcut set to represent a set of commands or a single command run with specific options. Use an alias to execute frequently used processes with as little as a single character.

List Existing Aliases


Where to Find and Edit Aliases in Bash, Z shell (ZSH), and fish

The Bash shell is the default on most modern operating systems. If using ZSH, oh-my-zsh or fish, the shell’s configuration file may be in another location. Based on the shell in use, the configuration profile will be found in:

  • Bash: ~/.bashrc
  • ZSH: ~/.zshrc
  • fish: ~/.config/fish/

Create a Temporary Alias

Aliases can be created through the command line using the syntax alias customName="commands the alias should run". For example:

alias webroot="cd /var/www/html/"

Remove an Alias

Any alias added through the command line can be unaliased using unalias:

unalias testalias

Create a Permanent Alias

To create a persistent alias, edit the configuration profile for your shell and add the alias to the end of the file:

File: ~/.bashrc
alias la="ls -al"

Refresh the Configuration

source the configuration file to refresh the configuration changes:

source ~/.bashrc

Alias Existing Linux Commands

Existing Linux commands can be aliased to run with frequently-used options. As with any alias, this should be used with caution as once a user is accustomed to the results of the alias, the user may expect the same results on other machines or terminals where the alias may not exist.

In this example, change the default behavior of the ls command to provide more information about files and directory structure:

alias ls="ls -aFhl"

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

This page was originally published on

Your Feedback Is Important

Let us know if this guide was helpful to you.

Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.