≡ Menu

BASH Shell setup filename tab-completion case insensitive

Q. I’m using BASH shell filename tab completion feature to complete file names and other stuff. However default tab-completion in bash case-sensitive. It cannot show me /tmp/Y* or /tmp/Y* files. How do I force filename tab-completion in bash case insensitive?

A. According to bash man page completion-ignore-case set to Off. If set to On, readline performs filename matching and completion in a case-insensitive fashion. Readline has variables that can be used to further customize its behavior. A variable may be set in the /etc/inputrc file with a statement of the form. So all you have to do is type following command:
$ set completion-ignore-case on

You need to add set completion-ignore-case on to /etc/inputrc command:
vi /etc/inputrc
Append text as follows:
set completion-ignore-case on
Close and save the file. For more information read bash man page.

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 8 comments… add one }
  • Corey Hart August 17, 2007, 4:16 am

    For tcsh / zsh users:

    set complete enhance

  • B.Su September 14, 2007, 10:55 am

    Thanks to you. This enabled me to explore further on input configurations and startup settings

  • B.Su September 14, 2007, 10:58 am

    Thanks to you. This enabled me to explore /etc more and will be helpful in startup settings and input configurations.

  • Rob January 13, 2012, 3:43 pm

    Doesn’t work.

  • Rob January 13, 2012, 3:44 pm

    Last one was meant @Corey Hart. WP does not seem to take into account which Reply button was clicked, quite surprising behavior…

  • Ted Feng April 27, 2012, 2:06 am

    should be
    $ bind ‘set completion-ignore-case on’
    to activate it immediately.

  • Ted Feng Fan October 18, 2012, 8:28 am

    Thanks Ted Fang.

  • Joe November 24, 2012, 6:47 pm

    You should make this change in ~/.inputrc when the setting is to apply to a single user.

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , ,