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?

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

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

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.