Ubuntu14.04 Tab键自动补全

Unbuntu14.04 终端中使用Tab键不能自动补全

解决方案

1、利用vi编辑器打开 /etc/bash.bashrc文件(需要root权限)

sudo vi /etc/bash.bashrc
  • 1

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




使用

比如,我们要在文件管理器中直接使用右键打开终端,nautilus-open-terminal 
每次只记得nauti,所以我们这是后Tab键就可以帮助大忙了。

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

多多使用Tab键,帮助我们快速完成繁杂的拼写工作

原文地址:https://www.cnblogs.com/cyyljw/p/8625092.html