Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use bash on both my Mac and as my cygwin shell. Overall, I'm quite pleased with it.

My one complaint however is that its TAB completion isn't as good as Windows Command Line TAB completion.

For example, if there are two files with the same prefix, then bash just beeps at me when I try to TAB complete. If I keep nailing TAB, then it will eventually show me a list of potential files.

I definately prefer how Windows will cycle through potential files right on the command line.

Is there a way to get bash to operate similar to Windows Command Line in this regard?

If there isn't (I do not want to switch shells), am I missing something about TAB completion in bash? Is there a more efficient way to use it?

share|improve this question
up vote 36 down vote accepted

To get the ‘cycle through possible completions’ behavior, copy the following into an appropriate place in your .bashrc file:

[[ $- = *i* ]] && bind TAB:menu-complete

Also, bash-completion provides many extra kinds of completion besides just pathname completion. For example, menu-complete works fine with Git's bash-completion module to complete command names, option names, etc.

share|improve this answer
You are my hero! I wish I had asked this question months ago. – Frank Krueger Oct 23 '09 at 2:07
what is the procedure to do this for OSx terminal? – Alex Nov 30 '11 at 14:19
@Alex: You edit the file .bashrc in your home directory so that it contains the specified line. If your .bash_profile file (in the same directory) does not also have a line like source ~/.bashrc, then you should also edit it to include such a line. The setting will be active in new Terminal windows. If you do not have a preferred editor, you can open the file in TextEdit with the command open -e ~/.bashrc; if the file does not yet exist, you will need to create it first with (e.g.) the command touch ~/.bashrc. – Chris Johnsen Dec 1 '11 at 2:46
It seems that bash isn't default for OSx. So I have to type in 'bash' to take advantage of the feature. I also noticed that autocomplete does not distinguish between folders and files, so when I type 'cd ' and hit TAB files will also be cycled. – Alex Dec 1 '11 at 19:07
Does anyone have any idea what should I bind to go one option back with Shift + Tab? – ppp Jan 2 '14 at 8:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.