alias 定义命令及参数的别名
alias [-p] [name[=value] ...]
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.
参数 | 功能 |
---|---|
-p | 列出当前所有的别名设置 |
1、正如man 文档所说,加与不加 -p 都列出所有别名列表。
alias -p
alias
运行图:
可以看出,cp就是cp -i 的别名,运行 cp 相当于运行 cp -i ,其他亦类似。
我用的Linux发行版为 Centos07 系统自带 vim 本系统并没有 vi;如果是Ubuntu ,默认是vi 编译器,如果你又额外安装了 vim ,就会多出下面一行:
alias vi=‘vim’
2、只是显示某个别名代表的含义可输入 alias name, 比如:
3、添加别名:
比如,我经常需要进入这个目录: cd /home/zynorl/Downloads 每次输入这么长,很麻烦,就可以对它用 alias 起别名。
4、取消命令别名: