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 if you create it, your local version will override the system version at /etc/inputrc
. The system version has lots of useful key mappings configured, such as Ctrl-Left
/Right
, and you have to link in the system version so you don't lose them.
The way to do this is to put the line $include /etc/inputrc
at the top of ~/.inputrc
, e.g.:
$include /etc/inputrc
set completion-ignore-case on
Once configured, you can apply the change, either by restarting 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
.