The alias is a naming alias, when some of the instructions you are accustomed to are particularly long, or you add a default option to prevent hand-slipping errors behind certain dangerous instructions.
For example, execute the following command: List all, including hidden documents, and display them by page
[Sun@localhost ~]$ Ls-al | More
Such commands, if you feel too long and annoying, can be set with the alias command:
[Sun@localhost ~]$ alias lm= ' Ls-al | More
Now, using the LM command will get the same effect.
Root can use RM to remove any data, and we need to be careful when we use root, but it's possible to accidentally slip and delete a document that shouldn't be deleted. RM provides an option for us to confirm that the document is deleted
[Root@localhost ~]# rm-i test.txt
Rm:remove regular empty file ' Test.txt '?
Rm-i asks the root user whether to confirm the deletion of the Test.txt document. So we can use the alias to give the RM instruction a default-I option to have the root user force the root to choose whether to delete the document.
[Root@localhost ~]# alias rm= ' Rm-i '
[Root@localhost ~]# RM text.txt
Rm:remove regular empty file ' Text.txt '?
This reduces the likelihood of accidental deletion and uses the alias to see which aliases are set
[Root@localhost ~]# Alias
Alias cp= ' Cp-i '
Alias l.= ' ls-d. *--color=auto '
Alias ll= ' Ls-l--color=auto '
Alias lm= ' Ls-al | More
Alias ls= ' ls--color=auto '
Alias mv= ' Mv-i '
Alias rm= ' Rm-i '
Alias Which= ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde '
Unalias Remove Alias, if LM this alias does not want to use again, can delete
[Root@localhost sun]# Unalias lm
[Root@localhost sun]# Alias
Alias cp= ' Cp-i '
Alias l.= ' ls-d. *--color=auto '
Alias ll= ' Ls-l--color=auto '
Alias ls= ' ls--color=auto '
Alias mv= ' Mv-i '
Alias rm= ' Rm-i '
Alias Which= ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde '