Linux – How to Make Bash More TAB Friendly

bashcommand linelinuxunix

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?

Best Answer

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.

Related Question