Linux alias command

Updated: 04/26/2017 by Computer Hope

About alias

alias instructs the shell to replace one string with another when executing commands.


Aliases are used to customize the shell session interface. Using alias, frequently-used commands can be invoked using a different, preferred term; and complex or commonly-used options can be used as the defaults for a given command.

Aliases persist for the current session. They can be loaded at login time by modifying the shell's .rc file. The invocation and usage of alias differs depending on the shell; see your shell's documentation for details.

alias syntax

alias [name=['command']]



Specifies the alias name.


Specifies the command the name will use as the alias.


Removes all alias definitions from the environment of the current shell session.


Sets and lists tracked aliases.


Sets or prints exported aliases. An exported alias is defined for scripts invoked by name.

alias examples


Invoking alias with no arguments will display all currently aliased commands.

alias ls='ls --color=auto'

Creates the alias "ls" such that using the ls command will always display color output.

alias ll='ls -la'

Create an alias "ll" which will run ls with the options to display all files (-a) in a long list format (-l).

alias ..='cd ..'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'

The above four commands create aliases for quickly navigating to one, two, three, or four higher-level directories, respectively. For instance, after these alises are set, typing the command "..." would navigate up the directory hierarchy twice.

alias port='netstat -tulanp'

Creates the alias "port", which would run netstat to display all currently open network ports.

unalias — Remove an alias.