Alias Frequently Used Commands in Linux
Traducciones al EspañolEstamos 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.
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.
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:
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/example.com/public_html"
Any alias added through the command line can be unaliased using
To create a persistent alias, edit the configuration profile for your shell and add the alias to the end of the file:
- File: ~/.bashrc
1 2 3
... alias la="ls -al" ...
source the configuration file to refresh the configuration changes:
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"
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