Enabling Bash Auto Completion on CentOS 7/8

Bash completion is a bash functionality that helps users type their commands faster and easier, by presenting possible options when the tab key is pressed while typing a command.

Bash auto-completion saves you time from typing text when it can be auto-completed, helps you to know the available continuations to a a specific command, and most importantly, prevents you from typing wrong commands as these are already completed for you.

Auto-completion isn’t a core feature of Bash, and as such, you might find some Linux installation lacking this functionality, especialy is you have opted for a minimal installation of Linux.

The steps below go through the installation of bash auto-completion in a CentOS 8 server with minimal installation.

The installation is very straight forward and is a two steps process. First, you need to install bash-completion script and the extra packages that come with it with dnf, then source the bash_completion.sh to add it to your ~/.bashrc file.

Install bash-completion along with its packages

Source the bash_completion.sh script

That’s it for this post, you will now be able to run commands with their auto-completion. To test the auto-completion feature, run any command then press TAB. Let’s do it with the yum command

 

Find this post interesting. Share it!

Leave a Comment

Your email address will not be published. Required fields are marked *