Bash – Apt-get autocompletion

aptautocompletebashnot-root-user

I am currently running 64-bit Debian Wheezy.

I am having some trouble with auto completion for apt-get. I have bash-completion installed.

If I am logged in as root in a shell, I can use auto completion for apt-get (ex: apt-get install wicd[tab][tab]) and it will show me all the packages that match that. But if I try to use auto completion for apt-get in another non-root user (even with sudo) it will not work at all. I can auto complete other things like file names.

Any help?

I do have the following code in my .bashrc and /etc/profile

 if [ -f /etc/bash_completion ]; then
      . /etc/bash_completion
 fi

Best Answer

Your /etc/bash_completion file must be missing.

sudo apt-get install bash-completion

should solve all your problems.

Given that you already have lines uncommented in /etc/bash.bashrc as Faheem Mitha and others pointed out, it should work now:

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

Reason: The bash-completion package now has that file (/etc/bash_completion). It used to be in the bash package, but not any more.

info on package change

Related Question