Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

At some moment

apt-get install

autocomplete was broken

It was very useful to me to see packages name with Tab press

How to repair this autocomplete?

share|improve this question
Please edit your question to add more information. What does it do now when you press tab? Is there an error? Please include it. – Oli Dec 9 '11 at 10:21
What package you were trying to find? Is it available via apt-cache search mypkg I am using Kubuntu on Oneiric i see it working well. – koolhead17 Dec 9 '11 at 11:18
For example I press tab after sudo apt-get install ruby, and terminal display me all packages with ruby: ruby-mysql, ryby-dev, etc. – Вячеслав Логинов Dec 9 '11 at 11:51
Yes, and what do you see instead when you press tab? – Oli Dec 9 '11 at 11:56
I see folders list, like cd +[TAB] – Вячеслав Логинов Dec 9 '11 at 11:59
up vote 73 down vote accepted

As stated in the comments to the other answer, first make sure that bash-completion is installed:

sudo apt-get install bash-completion

and apparently for @diapir, it helped to reinstall it:

sudo apt-get install --reinstall bash-completion

However, for me, the problem was not that bash-completion was not installed or broken, the problem was that I had accidently deleted my .bashrc file. You can get a new one by copying it from /etc/skel:

cp /etc/skel/.bashrc ~/
share|improve this answer
Thanks, the bashrc tip solved the problem for me as well. The use of sudo on the chmod command is unnecessary though, right? – BHSPitMonkey Dec 24 '12 at 4:32
the file located in /etc/ is 0644/-rw-r--r-- with user:group = root:root, and when copied to your user folder, will automatically go to user:user – kevinf May 28 '14 at 17:07
cp /etc/skel/.bashrc ~/ helped me solve this problem. – Jacob Abraham Nov 15 '15 at 8:54
Reinstall and copied /etc/skel/.bashrc helped me, thank you! – Sergey Apr 27 at 10:19

Type the following command:

sudo -H gedit /etc/bash.bashrc

Look for these lines:

# 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

Uncomment some lines, to make it look like this:

# 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

Save, close terminal, then reopen it.

I have this issue after installing 13.04, and that's how I resolve it.

share|improve this answer
thanks u so much !! – dav Feb 4 '15 at 9:15
this was the only thing that worked for me. thank you. – Nov 27 '15 at 7:40

Download the latest stable release from

sudo make install


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

to ~/.bashrc

share|improve this answer
bash-completion is in packages - is there any reason you did it manually? The package should do pretty much exactly this :) – Caesium Dec 10 '11 at 12:46
:) as always, sitting, reading manuals, configure, and then it turns out that this soft is exists in the repository – Вячеслав Логинов Dec 10 '11 at 12:57
sudo apt-get install --reinstall bash-completion did it for me. – diapir Apr 30 '12 at 0:48
@diapir, I have the same problem, but only reinstall does not working. I have to apply the lines in bashrc file. – Anwar Shah May 13 '12 at 17:09
@diapir +1 thank you! – Poni Aug 17 '12 at 3:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.