Linux How to enable case-insensitive and double tab key presses in Terminal

eye-catch Other techs
Sponsored links

Enable case-insensitive

If a tab key is pressed when $ cd Down is already input, it will automatically input the remaining characters and then become $ cd Downloads/.

Auto completion is very nice but it doesn’t work if I input $ cd down.

What!!!

Let’s enable the feature… Open /etc/inputrc.

$ sudo nano /etc/inputrc

Then, add the following line somewhere.

set completion-ignore-case on

Then, save the change.

It will be enabled the next time the terminal is opened.

Sponsored links

Enable double tab presses to show all the candidates

I want to show all the candidates when the tab key is pressed twice. It seems that the feature is disabled by default.

Open /etc/bash.bashr.

$ sudo nano /etc/bash.bashr

Then, find the auto-completion-related code like the following.

# enable bash completion in interactive shells
#if ! shopt -oq posix; then
#  if [ -f /usr/share/bash-completion/bash_completion ]; then
#    . /usr/share/bash-completion/bash_completion
#  elif [ -f /etc/bash_completion ]; then
#    . /etc/bash_completion
#  fi
#fi

Then, comment out.

# enable bash completion in interactive shells
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

This setting will be enabled after restarting the terminal.

Comments

Copied title and URL