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

Originally published at: https://www.cyberciti.biz/faq/add-bash-auto-completion-in-rhel8-redhat-enterprise-linux/

I set up a new RHEL 8 VM from cloud images, but my auto-completion of bash shell commands are not working. How do I enable autocomplete feature in RHEL 8 (Red Hat Enterprise Linux 8)? How do I write simple bash completion code in RHEL 8?

Has RHEL 8 really gone back to using yum? I thought Fedora had moved to replace it with dnf.

If you care about having decent shell completion, I’d suggest using zsh instead. It comes with an extensive set of completion definitions and has a superior system to bash’s.

It is actually dnf. yum is just a symlink to dnf.