ubuntu實現自動補齊的方法:
1.以root權限利用vi編輯器打開/etc/bash.bashrc文件,命令:
sudo vi /etc/bash.bashrc
2.找到/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
需要去掉去掉 if 到 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
3.最后刷新保存一下即可,命令:
source /etc/bash.bashrc