Aliases in Linux: the alias command
Updated July 3, 2026
An alias is a short name that the shell expands into a longer command.
Common cases
alias ll='ls -lh' # define an alias
alias # list every alias
alias gs='git status' # another example
unalias ll # remove an aliasHow it works: an alias lives in the shell
The shell expands the alias on its own before it runs a command, so it works only in an interactive session and is invisible to scripts. If you set it on the command line, it disappears when you close the shell. To keep it for good, add the
alias ...line to~/.bashrc. If an alias shadows a real command, run the command by its full path or with a leading\:\lsignores the alias.
Used in
You need this in the lesson The shell environment. The theory is the chapter The shell environment and configuration.
See also
Try it
Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.