ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Ubuntu-16.04.2-Server添加命令别名alias

Ubuntu-16.04.2-Server添加命令别名alias

原创 Linux操作系统 作者:dbasdk 时间:2017-06-09 23:05:03 0 删除 编辑

root@ubuntu:~# alias

alias egrep='egrep --color=auto'

alias fgrep='fgrep --color=auto'

alias grep='grep --color=auto'

alias l='ls -CF'

alias la='ls -A'

alias ll='ls -alF'

alias ls='ls --color=auto'

root@ubuntu:~# echo $SHELL

/bin/bash

root@ubuntu:~#

 

添加alias ..='cd .. --color=auto'到/etc/bash.bashrc并source /etc/bash.bashrc使配置生效

root@ubuntu:~# vi /etc/bash.bashrc

root@ubuntu:~# vi /etc/profile

root@ubuntu:~# vi /etc/bash.bashrc

root@ubuntu:~# vi /etc/bash.bashrc

root@ubuntu:~# tail /etc/bash.bashrc

                    /usr/share/command-not-found/command-not-found -- "$1"

                   return $?

                else

                    printf "%s: command not found\n" "$1" >&2

                    return 127

                 fi

        }

fi

#added on 20170609

alias ..='cd .. --color=auto'

root@ubuntu:~# source /etc/bash.bashrc

root@ubuntu:~# cd /tmp

root@ubuntu:/tmp# ..

root@ubuntu:/# alias

alias ..='cd .. --color=auto'

alias egrep='egrep --color=auto'

alias fgrep='fgrep --color=auto'

alias grep='grep --color=auto'

alias l='ls -CF'

alias la='ls -A'

alias ll='ls -alF'

alias ls='ls --color=auto'

root@ubuntu:/#

测试并查看,可以发现添加的命令别名已生效。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29734436/viewspace-2140556/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-07-02

  • 博文量
    490
  • 访问量
    1388122