自定义系统命令缩写

来源:互联网 发布:海关数据免费查询 编辑:程序博客网 时间:2024/05/01 18:17

添加系统全局变量:

步骤1:

使用root用户登录,在家目录下修改.bash_profile文件,查看结果如下:

[root@server132 ~]# more .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME
alias p='ps -ef|grep java'
alias rm='rm -i'
alias so='su - oracle'
alias sppd='/opt/jinrong/spider/bin/shutdown.sh'
alias sptm='/opt/jinrong/tomcat/bin/shutdown.sh'
alias stpd='/opt/xizang/spider/bin/startup.sh'
alias sttm='/opt/xizang/tomcat/bin/startup.sh'
alias tpd='tail -f /opt/jinrong/spider/logs/catalina.out'

alias ttm='tail -f /opt/xizang/tomcat/logs/catalina.out'


步骤2:

source ~/.bash_profile

关闭当前终端,重新打开终端,执行缩写命令即可