How to add bash auto completion in RHEL 8 (Red Hat Linux)

In Red Hat Enterprise Linux 8 (RHEL 8), bash auto-completion can be enabled by installing the “bash-completion” package. Here’s an overview of the steps you’ll need to take:

  1. Start by installing the “bash-completion” package by running the following command:
sudo dnf install bash-completion
  1. Once the installation is complete, you can activate the bash completion feature by adding the following line to your “.bashrc” file:
source /usr/share/bash-completion/bash_completion
  1. Next, reload the “.bashrc” file by running the following command:
source ~/.bashrc
  1. You should now be able to use the tab key to auto-complete commands and options.
  2. If you have installed additional software packages that provide command-line utilities, you may need to install the corresponding bash-completion package for those utilities. For example, to enable auto-completion for the “git” command, you would need to install the “git-completion” package.
  3. To check the list of package providing bash_completion you can use the following command
dnf search bash_completion

By following these steps, you should now have bash auto-completion enabled on your RHEL 8 system. If you encounter any issues or if auto-completion is not working as expected, you may need to check your “.bashrc” file for any errors or conflicts.

Leave a Comment