1.1 KiB
1.1 KiB
title
title |
---|
Bash Alias |
Alias
Set shortcuts for command line input to save time typing and recall complex commands easily.
Usage example
alias l="ls -alt"
. You can now simply input l
and the shell will understand it as ls -alt
.
Common implementation
It is common to place calls to alias
in an rc file, such as .bashrc for the bash shell. Bash runs the contents of the .bashrc file every time a new shell is opened, so aliases created there will always be available. (If you simply call alias
in the command line, it will only exist for that terminal window.) These files live in the home directory (~/
). The .
at the beginning of the filename makes the file hidden, requiring the -a
flag for ls
to show it. .bashrc is not created by default, so you may have to touch
it yourself.
Further reading
- gnu.org
alias
manual page - Stack Exchange post about .bashrc