I'd like for bash to rotate through the matching file names instead of listing them, like the default tab completion behavior in vim. Is there an easy command to do this? This is essentially the opposite of this question.


Map Tab to menu-complete.

In your ~/.inputrc:

"\C-i": menu-complete

Re-read the file to make it effective in the current shell by pressing Ctrl-x Ctrl-r.

You can use the following command at a command prompt to enable the feature for the current session if you'd like to test it without editing the ~/.inputrc file, for example.

bind '"\C-i" menu-complete'
  • 1
    Is there any way to make SHIFT + TAB go through the list in reverse? – ubiquibacon Jan 7 '14 at 14:58
  • @ubiquibacon: Generally speaking, in a terminal there's no difference between Tab and Shift + Tab (or other shifted vs. non-shifted control characters). However, you can use another keystroke to do the reverse stepping. bind '"\C-q" "\e-\C-i"' will cause Ctrl + Q to do this (or add "\C-q" "\e-\C-i" to your ~/.inputrc. You may need to add stty -ixon to your ~/.bashrc file to enable Ctrl + Q (and Ctrl + S). The \e- (Escape minus) is what reverses the direction. – Dennis Williamson Jan 7 '14 at 15:47

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.