與 Ubuntu 不同,預設在 Debian 的 bash 下執行 apt-get 是沒有自動補完功能的。如輸入
$ apt-get inst[tab]
shell 並不會自動補成
$ apt-get install
因此,需要動一些小手腳,讓 Debian 的 bash 也可以如 ubuntu 一般自動完成 apt-get 套件命令,自動搜尋已安裝或是正要安裝之 package。
修改 /etc/bash.bashrc 或是家目錄下的 .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
即可再登入 bash 後啟動 apt-get 等命令之自動補完成功能。