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?

ADVERTISEMENTS

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.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
8 comments… add one
  • Corey Hart Aug 17, 2007 @ 4:16

    For tcsh / zsh users:

    set complete enhance

  • B.Su Sep 14, 2007 @ 10:55

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

  • B.Su Sep 14, 2007 @ 10:58

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

  • Rob Jan 13, 2012 @ 15:43

    Doesn’t work.

  • Rob Jan 13, 2012 @ 15:44

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

  • Ted Feng Apr 27, 2012 @ 2:06

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

  • Ted Feng Fan Oct 18, 2012 @ 8:28

    Thanks Ted Fang.

  • Joe Nov 24, 2012 @ 18:47

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

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.