在Ubuntu下apt命令无法自动补全的解决的办法
自动补全依赖包bash-completion,首先确定该包已经安装。
1 |
apt install bash-completion |
确定已经安装后,调整配置文件即可,对于自动补全,有两份配置文件,分别为
1 2 3 4 5 6 7 8 9 |
vim ~/.bashrc ... # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). #if [ -f /etc/bash_completion ] && ! shopt -oq posix; then # . /etc/bash_completion #fi ... |
1 2 3 4 5 6 7 8 9 10 11 |
vim /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 ... |
前者是用户目录下的配置文件,后者则是全局的配置文件,根据前者的注释内容,考虑到一劳永逸,此处我们只需修改后者中的内容即可,将其注释去掉。
最后执行一下脚本内容配置成功
1 |
source /etc/bash.bashrc |
Hello. And Bye.