您的位置:首页 > 运维架构 > Linux

Linux命令详解 -- alias

2015-07-30 10:04 686 查看
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