How to fix apt bash completion in Ubuntu/debian

In some situations, especially when using an openvz vps one may notice that auto-completion is not working as it should (especially on debian). Luckily the fix is simple, in your terminal type:

apt-get install bash-completion

 

If that doesn’t work you can try the following

sudo apt-get install --reinstall bash-completion

or

sudo apt-get install auto-complete-el

or at a last result edit the following

sudo nano /etc/bash.bashrc

and change

# 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

to

# 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

Leave a Reply

Close Menu
%d bloggers like this: