Linux 命令之 alias

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、取消命令别名:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值