1. 程式人生 > >Unbuntu 終端中使用Tab鍵不能自動補全

Unbuntu 終端中使用Tab鍵不能自動補全

shells BE AC share 使用 util 註釋符 tab鍵 pan

解決方案

1、利用vi編輯器打開 /etc/bash.bashrc文件(需要root權限)

sudo vi /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

將註釋符號#去掉,即改成

#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即可, 即

sudo source /etc/bash.bashrc
  • 1

使用

比如,我們要在文件管理器中直接使用右鍵打開終端,nautilus-open-terminal
每次只記得nauti,所以我們這是後Tab鍵就可以幫助大忙了。

apt-get install nauti[Tab]       # apt-get install nautilus-open-terminal
  • 1

多多使用Tab鍵,幫助我們快速完成繁雜的拼寫工作

Unbuntu 終端中使用Tab鍵不能自動補全