修改/etc/bash.bashrc文件,搜索“bash_completion”,会看到如下一段:
# enable bash completion in interactive shells
#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
把其中代码部分的注释符“#”去掉,保存文件,退出shell再登录即可。