The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
   

Alias Command

An alias is a nickname given to a command. The basic usage of the alias command is as follows: alias nickname="command". Afterward, you can use this nickname to replace the command name. If there are no options provided, it will display a list of currently aliased commands.

Example:
$ alias ← Lists the commands that currently have aliases
alias l.='ls -d .*
alias ll='ls -l --color=tty'
alias vi='vim'
alias cls='clear' ←Creates an alias "cls" for the command "clear". From now on, typing "cls" is equivalent to typing "clear"

Aliases are only active during the current session. To make aliases persist across reboots, you can add them to the" ~/.bashrc" or " ~/.bash_aliases" files.

Although aliases are useful for simple command substitutions, they have limitations. They do not work with scripts and do not accept parameters like functions do.

To remove an alias, you can use the unalias command followed by the alias name. For example, to remove the alias created above, use the command unalias cls.

For more examples and usage, please refer to the provided link.