Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any way to make Bash tab complete case insensitively?

$ bash --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
Copyright (C) 2007 Free Software Foundation, Inc.

I am using Mac OS X 10.6

share|improve this question

2 Answers 2

up vote 49 down vote accepted

Update the text in /etc/inputrc to include

set completion-ignore-case on

Then use ^X ^R to reload the configuration.

share|improve this answer
12  
"as well" - /etc/inputrc or ~/.inputrc or a file designated by INPUTRC are the only places it can go. Entering that at a Bash prompt won't work. –  Dennis Williamson Jan 1 '10 at 21:11
    
whoops! you're right :) –  John T Jan 1 '10 at 21:18
    
Thank you, works perfectly. –  Jeffrey Aylesworth Jan 2 '10 at 0:00
3  
^X ^R to reload inputrc –  grawity Jan 2 '10 at 9:37
6  
@DennisWilliamson: you can do bind "set completion-ignore-case on" from the command line; for, I believe, that terminal session only –  Clay Bridges Oct 4 '11 at 19:45

Building on @ClayBridges' comment: To make the setting persistent, as an alternative to editing ~/.inputrc or /etc/inputrc, you can add

bind "set completion-ignore-case on"

to a shell profile file such as ~/.bash_profile.

Note that such commands in your profile take precedence over any defined in either /etc/inputrc or ~/.inputrc.

(A related command that makes completion of file and directory names easier is:

bind "set show-all-if-ambiguous on"

This makes it unnecessary to press Tab twice when there is more than one match.)

share|improve this answer
    
show-all-if-ambiguous is so nice! I often wondered why they made me tab twice to perform that action. thousands of keystrokes saved in my future! thanks! –  user34112 Sep 24 '13 at 7:16
    
Awesome, it even works for cd commands. Which solves this question and will be saving me thousands of keystrokes too. :) –  hoosierEE Mar 27 at 0:08

Your Answer

 
discard

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.