RHEL / CentOS Linux install and activate Bash completion

Bash completion is a feature in the bash shell that allows you to auto-complete commands, file names, and other things by pressing the Tab key. To install and activate bash completion in RHEL/CentOS Linux, follow these steps:

  1. Install the bash-completion package:
sudo yum install bash-completion
  1. Add the following line to your ~/.bashrc file:
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
fi
  1. Restart the shell or source the ~/.bashrc file:
source ~/.bashrc

After following these steps, bash completion should be installed and activated in your system. You can test it by starting to type a command, then press the Tab key, and the shell will automatically complete the command or show you a list of possible completions.

Leave a Comment