This is quick tip, howto use Bash auto complete (autocomplete) with DNF/YUM (package names/commands) on Fedora, CentOS, Red Hat (RHEL). Dnf package manager is used on Fedora 26/25/24/23/22 and Yum package manager is used on Fedora 21/20/19/18, CentOS 7.3/6.9 and Red Hat (RHEL) 7.3/6.9.

Autocomplete feature is familiar to many who have used the Debian based Linux, like Debian and Ubuntu. For some reason, this feature is not automatically activated/installed on Red Hat -based Linux distros, like Fedora, CentOS and Red Hat (RHEL). Actually auto completion works with any Bash programs, but I think it’s very useful example with DNF/YUM and also with RPM. You can autocomplete DNF/YUM commands and package names.

1. Install bash-completion

1.1 Change to root

su -
## OR ##
sudo -i

1.2 Install bash-completion package with DNF/YUM

## Fedora 26/25/24/23/22 ##
dnf install bash-completion sqlite

## Fedora 21/20/19/18, CentOS 7.3/6.9 and Red Hat (RHEL) 7.3/6.9 ##
yum install bash-completion

1.3 Logout console

Then logout console or close command line and log back in.

2. Autocomplete usage

[TAB] = press tab/tabulator

2.1 DNF/YUM commands

Example 1

## DNF ##
[root ~]$ dnf in[TAB][TAB]
info             info-security    install          install-na
info-sec         info-updateinfo  install-n        install-nevra

[root ~]$ dnf ins[TAB]  ## and you get "dnf install"


## YUM ##
[root ~]$ yum in[TAB][TAB]
info     install

[root ~]$ yum ins[TAB]  ## and you get "yum install"

Example 2

## DNF ##
[root ~]$ dnf s[TAB][TAB]
search              summary-updateinfo  
shell               swap

[root ~]$ dnf se[TAB]  ## and you get "dnf search"

## YUM ##
[root ~]$ yum s[TAB][TAB]
search  shell

[root ~]$ yum se[TAB]  ## and you get "yum search"

2.2 DNF/YUM package names

Example 1

## DNF ##
[root ~]$ dnf install fire[TAB][TAB]
firebird-3.0.1.32609-5.fc26.x86_64
firebird-devel-3.0.1.32609-5.fc26.i686
firebird-devel-3.0.1.32609-5.fc26.x86_64
firebird-doc-3.0.1.32609-5.fc26.noarch
firebird-examples-3.0.1.32609-5.fc26.noarch
firebird-utils-3.0.1.32609-5.fc26.x86_64
firefox-54.0-2.fc26.x86_64
firewalk-5.0-16.fc26.x86_64
firewall-applet-0.4.4.5-1.fc26.noarch
firewall-config-0.4.4.5-1.fc26.noarch
firewalld-0.4.4.5-1.fc26.noarch
firewalld-filesystem-0.4.4.5-1.fc26.noarch

[root ~]$ dnf install firef[TAB]  ## and you get "dnf install firefox-54.0-2.fc26.x86_64"

## YUM ##
[root ~]$ yum install fire[TAB][TAB]
firebird-classic.i686      firebird.i686              firecontrol.i686
firebird-devel.i686        firebird-libfbembed.i686   firehol.noarch
firebird-doc.i686          firebird-superserver.i686  firewalk.i686

[root ~]$ yum install fireh[TAB]  ## and you get "yum install firehol.noarch"

Example 2

## DNF ##
[root ~]$ dnf remove ge[TAB][TAB]
gedit-2:3.22.0-4.fc26.x86_64
genisoimage-1.1.11-34.fc26.x86_64
geoclue2-2.4.5-4.fc26.x86_64
geoclue2-libs-2.4.5-4.fc26.x86_64
geocode-glib-3.23.90-1.fc26.x86_64
GeoIP-1.6.11-1.fc26.x86_64
GeoIP-GeoLite-data-2017.06-1.fc26.noarch
gettext-0.19.8.1-9.fc26.x86_64
gettext-libs-0.19.8.1-9.fc26.x86_64

[root ~]$ dnf remove gen[TAB]  ## and you get "dnf remove genisoimage-1.1.11-34.fc26.x86_64"


## YUM ##
[root ~]$ yum remove ge[TAB][TAB]
gedit.i686           geoclue-devel.i686   geronimo-jms.noarch  gettext.i686
gegl.i686            geoclue.i686         geronimo-jta.noarch  gettext-libs.i686
genisoimage.i686     GeoIP.i686           gettext-devel.i686

[root ~]$ yum remove gen[TAB]  ## and you get "yum remove genisoimage.i686"

Note: If you run this without any letter then it might take very very long time.