Configuration Alias

第一个里程碑 ---- 查看系统别名

[root@xilong ~]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

第二个里程碑 ---- 配置系统别名

[root@xilong ~]# alias xilong='pwd'
[root@xilong ~]# xilong
/root

第三个里程碑 ---- 临时生效

要求: 执行rm命令时,提示“Do not use this command!1:临时生效
[root@xilong ~]# alias rm='echo "do not use this command"'
[root@xilong ~]# rm
do not use this command

第四个里程碑 ---- 永久生效

[root@xilong ~]# tail -2 /etc/profile
#alias
alias rm='echo "Do not use this Command!"'
[root@xilong ~]# source /etc/profile
[root@xilong ~]# rm
Do not use this Command!

[root@xilong ~]# cat /root/.bashrc 
# .bashrc

# User specific aliases and functions

#alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

猜你喜欢

转载自www.cnblogs.com/xilong-devops/p/9038117.html