Is it possible for bash completion to cycle through the alternatives?

When using bash completion and an a number of characters have been entered, tabbing ceases to work when the prefix you have typed is matched by more than one of the possibilities.

Is there a way to cycle through the alternatives of the prefix you have entered?

Asked By: vfclists


Bind the Tab key to the menu-complete command instead of the default complete. Put the following line in your ~/.bashrc:

bind '"C-i": menu-complete'

or the following line in your ~/.inputrc (this will apply to all programs that use the readline library, not just bash):

"C-i": menu-complete

In bash 4.1 and later you can also use menu-complete-backward to cycle through completions backwards. I have this in my ~/.inputrc:

"es": menu-complete-backward
"et": menu-complete
Answered By: Lri
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.