Bash filename completion explanation

autocompletebash

I have two files in a directory, test1 and test2. If I type

less te<TAB>

completion kicks in and expands te to test. If I hit TAB a second time nothing happens, and only when I press TAB a third time do I get offered the two matching filenames I might mean.

My question is, why does it take two presses after bash completes as far as it can, before I get offered my choices. Surely it would make more sense to be offered them after the second (in total) of the presses?

Best Answer

Add this to ~/.inputrc

set show-all-if-ambiguous on

Quoting from arch wiki on this topic

Or you can set it such that a single tab will perform both steps: partially complete the word and show all possible completions if it is still ambiguous:

Related Question