Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 30 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 ~/
sudo chmod 644 ~/.bashrc
share|improve this answer
1  
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
add comment

Type the following command:

sudo 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
  fi
fi

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
add comment

Download the latest stable release from http://bash-completion.alioth.debian.org/

./configure
make
sudo make install

insert

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

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
2  
sudo apt-get install --reinstall bash-completion did it for me. –  diapir Apr 30 '12 at 0:48
2  
@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
add comment

Your Answer

 
discard

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.