Tab autocomplete in terminal is not behaving properly

9,352

Solution 1

It is caused due to acrobat reader. The file is -

/etc/bash_completion.d/acroread.sh

Removing this file, worked correctly for me.

Solution 2

Edit:

Sorry, my original suggestion was incorrect; I didn't pay attention and was thinking about autocompletion when you press the up-arrow, not tab (as pointed out to me after my post).

Original suggestion about history autocompletion

This is controlled by the file ~/.bash_history, which is a text file, so you can look at it, or even edit it. It doesn't save your history forever, so it's possible the old one scrolled off the list. It's also possible that this file got corrupted somehow.

It should be just a long list of commands, in reverse chronological order, with each command on a single line, delimited by linebreaks, so you should be able to see if there's something unusual in it.

I never really thought about this, but you could probably save lines you use a lot, and occasionally append it to this file to make sure you always have those commands.

A better suggestion for Tab Autocompletion

Did you edit this? I don't think it changes, so maybe it's something that was added to /etc/bash_completion.d, which seems to have scripts added to it by installed apps. You could try disabling some of the ones with more recent timestamps to see if it makes a difference, then adding them back one by one or in small groups until it changes. I don't know much about this, but I'm usually good at fixing problems, so my suggestions are not from prior knowledge, but just me trying to be helpful.

Share:
9,352

Related videos on Youtube

CaptSaltyJack
Author by

CaptSaltyJack

Updated on September 18, 2022

Comments

  • CaptSaltyJack
    CaptSaltyJack almost 2 years

    There's something odd about my autocomplete in the gnome terminal.

    I used to be able to type cp Downtab to get cp Downloads/, and then type Jettab to end up with cp Downloads/Jet\ Pack\ Instructions.pdf

    But now, when I have cp Down typed and hit tab, I get cp Downloads with a space afterwards. And if I backspace that and make it say cp Downloads/Jet and hit tab, I get cp Downloads/Jet Pack Instructions.pdf without the backslashes.

    It wasn't like this before. How do I fix this?

    EDIT: There's a problem with my /etc/bash_completion file, it seems. Just not sure what.

    • Marius
      Marius about 12 years
      Have you edited your ~/.bashrc? You could try renaming it to .bashrc.backup and seeing if that fixes it.
  • Andrew Wonnacott
    Andrew Wonnacott about 12 years
    It's not controlled by history - tabcompletion has to do with directories and paths, and doesn't check the past entries at all. You are thinking of command history (pressing up) not completion (pressing tab)
  • Deepak Verma
    Deepak Verma about 12 years
    Oh, you're right, I wasn't thinking clearly. I'll edit my post to avoid confusing anyone else besides myself! :(
  • Andrew Wonnacott
    Andrew Wonnacott about 12 years
    It's OK! Everyone does this sometimes.
  • CaptSaltyJack
    CaptSaltyJack about 12 years
    It's something wrong in my /etc/bash_completion file, but I don't know what.
  • Deepak Verma
    Deepak Verma about 12 years
    Did you edit this? I don't think it changes, so maybe it's something that was added to /etc/bash_completion.d, which seems to have scripts added to it by installed apps. You could try disabling some of the ones with more recent timestamps to see if it makes a difference, then adding them back one by one or in small groups until it changes. I don't know much about this, but I'm usually good at fixing problems, so my suggestions are not from prior knowledge, but just me trying to be helpful.
  • CaptSaltyJack
    CaptSaltyJack about 12 years
    @MartyFried Please post your suggestion as an answer so I can give you points. This solved it! acroread.sh had some bad programming in it. Removing it from the /etc/bash_completion.d folder solved it.
  • Deepak Verma
    Deepak Verma about 12 years
    Thanks for the suggestion - I incorporated the answer into my orignal post. I'm glad it helped you, and it helped me redeem myself. :-)
  • CaptSaltyJack
    CaptSaltyJack about 12 years
    Yep! Already solved it, forgot to answer my own Q.. so you get the point. :)