1、别名配置文件为 ~/.bashrc.
例如将:为‘echo $?’命令指定别名为q:
[root@centos79 ~]# vim ~/.bashrc # .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias q='echo $?' ## 增加该行 # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
2、测试效果
[root@centos79 ~]# q bash: q: command not found... [root@centos79 ~]# source ~/.bashrc ## 重新加载配置文件 [root@centos79 ~]# q 0 [root@centos79 ~]# mkdir Music/ mkdir: cannot create directory ‘Music/’: File exists [root@centos79 ~]# q 1
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。