一、利用vi編輯器打開 /etc/bash.bashrc文件(須要root權限)sql
sudo vi /etc/bash.bashrc
接下來會提示輸入密碼shell
二、找到文件中的下列代碼ruby
#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
將註釋符號#去掉,即改爲bash
#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
三、最後 source一下 /etc/bash.bashrc便可, 即編輯器
sudo source /etc/bash.bashrc