1.切换root用户,查看 /etc/bash.bashrc 文件
2.找到对应内容
# 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
vi 文件删除对应代码注释
# 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
保存退出 :wq!
3.source 文件
source /etc/bash.bashrc