16

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?

1
  • If using another shell is an option, I believe both fish and zsh do this.
    – terdon
    Jul 26, 2014 at 13:17

2 Answers 2

13

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
6

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .