Can I make Tab auto-completion case-insensitive in Bash?

Ubuntu's Terminal uses case-sensitive auto-completion, as I suppose would be expected for Linux.

But I think it would often be more convenient to use a case-insensitive one instead, to save you having to be accurate while starting a name, and would probably be worth the extra false positives. Is it possible to change this behaviour?


In order to make bash case-insensitive for to current user:

Run the following shell script in a terminal:

# If ~/.inputrc doesn't exist yet: First include the original /etc/inputrc
# so it won't get overriden
if [ ! -a ~/.inputrc ]; then echo '$include /etc/inputrc' > ~/.inputrc; fi

# Add shell-option to ~/.inputrc to enable case-insensitive tab completion
echo 'set completion-ignore-case On' >> ~/.inputrc

Start a new shell (reopen the terminal).

To Make the changes systemwide:

# add option to /etc/inputrc to enable case-insensitive tab completion for all users
echo 'set completion-ignore-case On' >> /etc/inputrc
# you may have to use this instead if you are not a superuser:
echo 'set completion-ignore-case On' | sudo tee -a /etc/inputrc

For details, see man bash . Yes it is a long page, but bash is a somewhat complex program, and if you want just search that page for "case-insensitive" to go to the relevant section. People usually learn bash one option at a time or one bash script at a time and it takes a long time to master all the nuances. Your interest may vary.


Open a terminal and type the below command:

echo set completion-ignore-case on | sudo tee -a /etc/inputrc

Enter password. Restart terminal.

If in some case you want to remove case insensitive, just edit /etc/inputrc file by removing the set completion-ignore-case line.

That's all.


I know this question is very old but unless I am missing something I think I have a super simple solution if you are using bash.

echo "bind 'set completion-ignore-case on'" >> ~/.bashrc

Or just add the line using your favorite text editor. Restart your bash session and enjoy.


You can do this by setting a configuration variable for GNU readline, which is what handles the input in an interactive shell.

The variable needed is completion-ignore-case, and can be set directly in your bash session with:

bind "set completion-ignore-case on"

It can be enabled for all future bash sessions by putting set completion-ignore-case on into the users's ~/.inputrc file, or the system /etc/inputrc, to enable it for all users. This is the initialisation file for readline.

(Note that ~/.inputrc probably doesn't exist, and you will have to create it, this will override the system copy at /etc/inputrc. This has lots of useful key mappings configured, such as Ctrl-Left/Right.

The way to fix this problem is to put the line $include /etc/inputrc at the top of ~/.inputrc, e.g.:

$include /etc/inputrc

set completion-ignore-case on

Then either restart bash or reload inputrc, e.g. with Ctrlx,Ctrlr.)

More information about readline and inputrc can be found in man bash and man 3 readline.