Alias is a shortcut that saves the trouble of inputting a long string of commands. It can also unify differences between Windows, Linux, and Unix commands to meet users' input habits. $
Alias is a shortcut that saves the trouble of inputting a long string of commands. It can also unify differences between Windows, Linux, and Unix commands to meet users' input habits.
$ Alias new_command = 'command sequence'
$ Alias ll = 'ls-Al'
# The configured alias is temporary. once the terminal is closed, the configured alias becomes invalid. to keep the alias valid, you can add it ~ /. Bashrc file. (Every time a new SHELL is generated, it will execute ~ /. The command in bashrc) is as follows:
$ Echo 'Alias cmd = "command seq" '> ~ /. Bashrc
To delete an alias, you only need to extract the corresponding statement from ~ /. Bashrc, or use the unalias command.
Note: When creating an alias, if an alias with the same name already exists, the original alias settings will be replaced.
Sometimes, Aliases may cause security problems: in an untrusted environment, commands may have been disguised and important information such as accounts and passwords may be stolen.
Methods to avoid such problems:Escape aliases (add \ before the command \)
$ \ Command
# Escape commands so that we can execute the original commands instead of the commands themselves.