Bash
Add the following to your ~/.bashrc
-file:
bind -s 'set completion-ignore-case on'
This enables case-insensitive completion in bash, as explained by Gilles' answer in
How to make cd arguments case INsensitive?.
Tested with bash 5.0.17 on Ubuntu 20.04.
Other options
I have only tested bash and zsh. This is what I found out for other shells:
The other option in the linked answer adds set completion-ignore-case on
to inputrc
. That could be used by other shells, too. According to this answer, which also talks about whether to use this option with bash.
Therefore, if not using bash, researching your specific shell first is a good idea (unless others will add tested answers for other shells).
Zsh
zsh
uses a different line editor and not readline/inputrc. On install it gives the option to press 2
to add a recommended ~/.zshrc
, which already includes the following line. It makes the the desired behaviour work out of the box:
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za- z}' 'r:|[._-]=* r:|=* l:|=*'
Tested with zsh 5.8 on Ubuntu 20.04.
This also might be helpful: Combining zsh’s tab completion with case insensitivity
cd Test
and then Tab? It may be about case sensitivity. Or do you explicitly want your tab completions to be case-insensitive? What is the shell?bash
on most Linuxes,zsh
on up-to-date Macs). But unix-style file and directory names are case sensitive: in a single directory, bothtest
andTest
could exist at the same time, and be two different files or directories. Usually, the shell will not change the case of typed characters on tab-completion, but your shell might have an option to enable it.echo $SHELL
says?