1.修改/etc/bash.bashrc文件

vim /etc/bash.bashrc

2.将下面的注释#去掉

#if ! shopt -oq posix; then  
#      if [-f  /usr/share/bash-completion/bash_completion ]; then  
#          . /usr/share/bash-completion/bash_completion  
#      elif [ -f /etc/bash_completion]; then  
#           . /etc/bash_completion  
#      fi  
#fi

3.source一下 /etc/bash.bashrc

source /etc/bash.bashrc