一、介绍
alias 命令用来设置Linux shell 命令的别名。可以使用alias命令将较长的命令简写使用.
二、使用方法
语法:alias (选项)(参数) 选项:-p:打印已经设置的Linux shell别名 参数:'定义Linux shell别名'
三、案例
1.alias定义别名ssh_5_13
[root@ping ~]# alias ssh_5_13='ssh root@10.157.5.13'
2.查看系统已经设置的别名
[root@ping ~]# alias alias cp='cp -i' alias l.='ls -d .* --color=auto' alias ll='ls -l --color=auto' alias ls='ls --color=auto' alias mv='mv -i' alias rm='This command cannot be used' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
3.设置别名对当前用户生效
[root@ping ~]# vim /root/.bashrc #将alias写入到配置文件中 [root@ping ~]# source /root/.bashrc #对配置文件立即生效
4.屏蔽当前别名
[root@ping ~]# m -rf /root/*