alias - Unix, Linux Command



alias - This command creates an alias. Aliases allow a string to be substituted for a word when it is used as the first word of a simple command.


alias [-p] [name[=value] ...]


If arguments are supplied, an alias is defined for each name whose value is given. If no value is given, alias will print the current value of the alias. Without arguments or with the -p option, alias prints the list of aliases on the standard output in a form that allows them to be reused as input. The value cannot contain any positional parameters ($1 etc), if you need to do that use a shell function instead.

The name can not be 'alias' or 'unalias'.


-pPrint the current values
-aRemove All aliases.


  • To create an alias to clear the screen.

    $ alias cls='clear'

    Use the alias

    $ cls
  • To create an alias 'ls' to change the default action of ls.

    $ alias ls='ls --a'

    Use the alias

    $ ls
    . .. sample.txt
  • To create various alias using cd command to go into to sub-sub directories.

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

    Use the alias

    $ mkdir sample
    $ cd sample
    $ pwd
    $ ..
    $ pwd
  • To create alias to display present working directory.

    $ alias .='echo $PWD'

    Use the alias

    $ .
  • To create alias to prevent accidental deletion.

    $ alias rm='rm -i'

    First create a sample.txt file

    sample text

    Remove the sample.txt file interactively

    $ rm sample.txt
    rm: remove regular file 'sample.txt' ?