Linux: How to Install and Enable Bash Completion
This post will guide you how to install and enable bash auto completion on CentOS/RHEL Linux. How do I add auto completion in Ubuntu/Debian Linux.
Install and Enable Bash Completion
If you want to use bash auto completion feature in Linux, you need to install bash-completion package in your Linux system.
For CentOS/RHEL Linux, you need to use yum command to install it, type:
# yum install bash-completion
Outputs:
[root@osetc_x8664 ~]# yum install bash-completion Loaded plugins: rhnplugin, ulninfo This system is receiving updates from RHN. Resolving Dependencies --> Running transaction check ---> Package bash-completion.noarch 1:2.1-6.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================== Package Arch Version Repository Size ========================================================================================================================================================== Installing: bash-completion noarch 1:2.1-6.el7 RH7_x86_64_latest 85 k Transaction Summary ========================================================================================================================================================== Install 1 Package Total download size: 85 k Installed size: 259 k Is this ok [y/d/N]: y Downloading packages: bash-completion-2.1-6.el7.noarch.rpm | 85 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:bash-completion-2.1-6.el7.noarch 1/1 Verifying : 1:bash-completion-2.1-6.el7.noarch 1/1 Installed: bash-completion.noarch 1:2.1-6.el7 Complete!
For Ubuntu/Debian Linux, you need to use apt command to install bash-completion package, type:
$ sudo apt-get install bash-completion
Then you need to logout your current bash shell and login again. the bash auto completion feature should be enabled. you can try one command, such as: press “yum i” then press TAB key. you should see that the command will be completed automatically.
# yum i[TAB]
Outputs:
[root@osetc_x8664 ~]# yum in info install [root@osetc_x8664 ~]# yum install