原文见:https://www.jb51.net/article/109719.htm
首先进入root模式,输入 vim /etc/bash.bashrc
可以看到里面有这几行语句
#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
去掉注释
#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
修改后,保存退出。
. /etc/bash.bashrc就可以了。