编辑/etc/bash.bashrc文件(必须以管理员权限),找到以下几行:
# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
# . /etc/bash_completion
#fi
把后三行前面的#去掉,取消注释,变为:
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
然后重新打开终端窗口(或者重新登录),恢复正常