alias (别名名称)= (实际命令)
[root@room9pc01 ~]# alias panfeilong=pwd #panfeilong别名代替pwd命令
[root@room9pc01 ~]# panfeilong
/root
unalias 别名名称 (取消别名)
[root@room9pc01 ~]# unalias panfeilong
[root@room9pc01 ~]# pwd
/root
[root@room9pc01 ~]# panfeilong
bash: panfeilong: 未找到命令...
把命令写到root里面,home /用户里面
[root@room9pc01 ~]# vim /root/.bashrc
alias pan='pwd' #pan别名替换pwd命令[root@room9pc01 ~]# vi /home/Student/.bashrc #student 是用户
alias pan='pwd' #pan别名替换pwd命令
- 全局别名