解決 debian sudo TAB 鍵不能自動補全命令的緣由
通常狀況,命令行輸入 sudo apt-get ins 按 tab ,它後面會自動補全爲 install 若是右面寫了包的名的一部分,按 tab 它也會自動完成或列出候選的,此次parrotOS(基於debian)忽然很差使了
首先確認是否安裝了 自動補全的插件,輸入
apt-get install bash-completion
而後在/etc/bash.bashrc :
即 在 .bash_profile 里加
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
就 ok 了
連接:http://gumelta.com/add-bash-completion-in-debian.php
完整 copy 下來吧:
Add Bash Completion In Debian
ash completion is a useful tool for completion of file paths, commands etc. By default it is enabled on Ubuntu but not on Debian. With two simple steps it can also be enabled on Debian.php
- Install bash-completion
First of all we need the install the according package:
apt-get install bash-completion
- Add it to the bash profile
Either edit the ~/.bash_profile file to enable it only for a given user or edit /etc/profile to add it system-wide. Add the following code:
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
- Try it In order for it to work you have to log out and relogin and then you can make use of bash completion the usual way. E.g. issue: apt-g and then press the TAB key once and the command will be completed to apt-get. Or issue this: apt and then press TAB key twice. You can also try with apt-get install apa and then press TAB key once to complete as far as possible and a second time to list all options.