Linux命令详解 -- alias

Alias with no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output.  When arguments

              are supplied, an alias is defined for each name whose value is given.  A trailing space in  value causes the next word to be checked  for

              alias  substitution when the alias is expanded.  For each name in the argument list for which no value is supplied, the name and value of

              the alias is printed.  Alias returns true unless a name is given for which no alias has been defined.


              Note aliases are not expanded by default in non-interactive shell, and it can be enabled by setting the expand_aliases shell option using

              shopt.


alias 命令

作用:

 设置命令别名,可以将较长的命令进行简化,使用alias 时,用户必须使用单引号将原来的命令引起来,防止特殊字符导致错误。

如要永久生效则将alias 命令存放到bash 的初始化文件 /etc/bashrc中。

语法:
alias (选项)(参数)
选项:
-p: 打印已经设置的目录别名
参数:
命令别名 = 实际命令
实例:
alias 新命令= '原命令 -选项/ 参数'

alias l  ='ls -lsh'

删除别名: unalias 别名

查看系统设置的别名:   键入 alias 



你可能感兴趣的:(alias)