解决方法
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
3、将注释符号#去掉,即改成
#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
4、最后 source一下 /etc/bash.bashrc即可, 即
sudo source /etc/bash.bashrc
使用
你可以apt-get install xx
加tab
试一下
Centos7 自动补全包,安装:
yum -y install bash-completion
或者你可以安装一些初始化的包组
yum -y groupinstall Base Compatibility libraries Debugging Tools Dial-up Networking suppport Hardware monitoring utilities Performance Tools Development tools
退出ssh重新连接生效。