In my previous linux installations the bash auto-completion has always worked without problems. If I wanted to do anything to files, giving a prefix of the filename and pressing tabulator listed all that matched the prefix but it also repeated the prompt below it with my command and prefix, so that I could immediately continue typing.

Now I have updated my system to kubuntu 18.04 and the auto-completion doesn't work as fluently anymore. What is even stranger, the behaviour is unpredictable like it depended on the konsole. If the command is less, it works always correctly (as described above), but if the command is cp or mv, the behaviour varies. Sometimes it works correctly, but often it shows a list of matching files with more (hiding my prompt) and I have to type q to exit more and be able to continue. A small thing, but annoying since it requires extra typing.

I see that .bashrc calls /usr/share/bash-completion/bash_completion but I haven't done any changes to this.

Question: What causes this unpredictable behaviour? How can I fix it?


The reason turned out to be very simple: If the terminal is sufficiently large, auto-completion can show all alternatives above the prompt (on two columns), but if it is too small, it uses more. So, the trick is to use sufficiently large terminals.

For some reason, I had not encountered this in my previous installations, maybe due to larger terminals/smaller font. With less, everything worked well, because there were fewer alternatives and they fitted the terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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