Linux alias command

Updated: 05/04/2019 by Computer Hope
alias command

On Unix-like operating systems, the alias command 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 [name=['command']]



Invoking alias with no arguments displays all currently aliased commands.

alias ls='ls --color=auto'

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

alias ll='ls -la'

Create an alias "ll" which runs 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.