How to enable bash completion in AlmaLinux/RHEL based OS

  • Post last modified:April 10, 2022
  • Reading time:5 mins read
  • Post author:
  • Post comments:0 Comments

After switching from the Debian distribution to AlmaLinux, I have found that bash-completion is not working when I press the TAB button for the next available suggestion

I am very used to the bash-completion feature as it makes my job very easy. Can you tell me the steps to turn on this feature on my AlmaLinux machine?

Of course, I’ll guide you on how to enable the bash-completion feature in all RHEL-based distributions like AlmaLinux, Rocky Linux, CentOS Stream, Fedora, and other major RHEL-based distributions.

Steps to enable Bash completion feature in AlmaLinux/RHEL Based OS

The Bash completion feature is enabled by default in Ubuntu/Debian-based distributions, and that is why we never cared about this feature until we tried the RHEL-based OS.

In the RHEL distribution, you need to install bash-completion utilities manually to turn on the tab-completion feature.

Some users may prefer to say “TAB Completion” because you need to press the TAB button to suggest the next line according to your readline.

Nala: A Beautiful and Structured Frontend for the APT Command

Download Bash completion utility

You just have to download the bash-completion utility, and after that, you can turn on bash completion on your AlmaLinux or any other RHEL-based distribution.

Open your terminal window and paste the following code into your AlmaLinux or Rocky Linux terminal window. The same command is applicable to Fedora.

sudo dnf install bash-completion

And it will ask for your confirmation before installing, so simply press Y.

[[email protected] ~]$ sudo dnf install bash-completion
Last metadata expiration check: 1 day, 2:14:30 ago on Saturday 09 April 2022 12:44:11 AM EDT.
Dependencies resolved.
 Package                   Architecture  Version            Repository     Size
 bash-completion           noarch        1:2.7-5.el8        baseos        273 k
Installing dependencies:
 libpkgconf                x86_64        1.4.2-1.el8        baseos         35 k
 pkgconf                   x86_64        1.4.2-1.el8        baseos         38 k
 pkgconf-m4                noarch        1.4.2-1.el8        baseos         17 k
 pkgconf-pkg-config        x86_64        1.4.2-1.el8        baseos         15 k

Transaction Summary
Install  5 Packages

Total download size: 378 k
Installed size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): pkgconf-1.4.2-1.el8.x86_64.rpm           310 kB/s |  38 kB     00:00    
(2/5): libpkgconf-1.4.2-1.el8.x86_64.rpm        268 kB/s |  35 kB     00:00    
(3/5): pkgconf-pkg-config-1.4.2-1.el8.x86_64.rp 394 kB/s |  15 kB     00:00    
(4/5): pkgconf-m4-1.4.2-1.el8.noarch.rpm        352 kB/s |  17 kB     00:00    
(5/5): bash-completion-2.7-5.el8.noarch.rpm     972 kB/s | 273 kB     00:00    
Total                                           265 kB/s | 378 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : pkgconf-m4-1.4.2-1.el8.noarch                          1/5 
  Installing       : libpkgconf-1.4.2-1.el8.x86_64                          2/5 
  Installing       : pkgconf-1.4.2-1.el8.x86_64                             3/5 
  Installing       : pkgconf-pkg-config-1.4.2-1.el8.x86_64                  4/5 
  Installing       : bash-completion-1:2.7-5.el8.noarch                     5/5 
  Running scriptlet: bash-completion-1:2.7-5.el8.noarch                     5/5 
  Verifying        : bash-completion-1:2.7-5.el8.noarch                     1/5 
  Verifying        : libpkgconf-1.4.2-1.el8.x86_64                          2/5 
  Verifying        : pkgconf-1.4.2-1.el8.x86_64                             3/5 
  Verifying        : pkgconf-m4-1.4.2-1.el8.noarch                          4/5 
  Verifying        : pkgconf-pkg-config-1.4.2-1.el8.x86_64                  5/5 

  bash-completion-1:2.7-5.el8.noarch         libpkgconf-1.4.2-1.el8.x86_64     
  pkgconf-1.4.2-1.el8.x86_64                 pkgconf-m4-1.4.2-1.el8.noarch     


But if you are following this guide for CentOS 7 then you need to copy-paste the below code into your terminal window:

sudo yum install bash-completion bash-completion-extras

thefuck: Automatically Correct Previous Incorrect Command

Enable Bash or TAB completion

Once the above method is complete, you need to log out of your current session, and after that, you can log in to test the bash-completion feature on your machine.


Finally, I can use the bash-completion method in AlmaLinux. 

Wrap up

That’s all to enable bash completion or TAB completion feature in AlmaLinux/RHEL based distributions.

Bash Keyboard Shortcuts to be a pro users!

If you are facing any other problem, then you can use our site search option to find other how-to and troubleshoot steps articles.

Leave a Reply