CentOS does not install autocompletion support for all tools by default, so we need to install it manually.

Check If We Have Bash Completion Installed

We can use the following command to verify:

1
yum list installed | grep completion

We won’t see any output if it hasn’t been installed, so we need to install this package:

Install

1
yum install bash-completion -y

Although it is installed, it has not yet been loaded into the running bash, so we need to use the source command to load them into the bash:

Reload

1
source /etc/profile.d/bash_completion.sh
img

currently there is only one tool completely support autocompletion

Experiment

Now we can try typing yum and then pressing the tab key twice:

1
yum    # There is no space behind yum command
img

after typing yum, we press tab key twice

We can see a list of auto-complete recommendations for this command.

We can also try automatic completion of yum parameters:

1
yum     # There is a space behind yum command
img

after adding a space behind yum, we press tab key twice

All right, that’s all the auto-complete information. See reference for more information.

References Bash completion is very incomplete on CentOS 7, RHEL / CentOS Linux install and activate Bash completion

Buy me a coffeeBuy me a coffee