Tab autocomplete in terminal is not behaving properly
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.
Related videos on Youtube
CaptSaltyJack
Updated on September 18, 2022Comments
-
CaptSaltyJack almost 2 years
There's something odd about my autocomplete in the gnome terminal.
I used to be able to type
cp Down
tab to getcp Downloads/
, and then typeJet
tab to end up withcp Downloads/Jet\ Pack\ Instructions.pdf
But now, when I have
cp Down
typed and hit tab, I getcp Downloads
with a space afterwards. And if I backspace that and make it saycp Downloads/Jet
and hit tab, I getcp 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 about 12 yearsHave you edited your
~/.bashrc
? You could try renaming it to.bashrc.backup
and seeing if that fixes it.
-
-
Andrew Wonnacott about 12 yearsIt'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 about 12 yearsOh, you're right, I wasn't thinking clearly. I'll edit my post to avoid confusing anyone else besides myself! :(
-
Andrew Wonnacott about 12 yearsIt's OK! Everyone does this sometimes.
-
CaptSaltyJack about 12 yearsIt's something wrong in my /etc/bash_completion file, but I don't know what.
-
Deepak Verma about 12 yearsDid 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 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 about 12 yearsThanks for the suggestion - I incorporated the answer into my orignal post. I'm glad it helped you, and it helped me redeem myself. :-)
-
CaptSaltyJack about 12 yearsYep! Already solved it, forgot to answer my own Q.. so you get the point. :)