16

I am trying to get tab-completion working in Yum in CentOS 6 (so I can do something like yum install firefo<TAB> and get back firefox), and I have found many tutorials which say to simply do yum install bash-completion, but when I do this, I get this back:

Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: mirror.anl.gov
 * extras: yum.singlehop.com
 * updates: mirror.ubiquityservers.com
Setting up Install Process
No package bash-completion available.
Error: Nothing to do

Is there some repository I should add?

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
sans
  • 263
  • 1
  • 2
  • 5

4 Answers4

14

CentOS needs to have EPEL Yum repository enabled in order to install bash-completion package.

See https://fedoraproject.org/wiki/EPEL for details.

Ignacio Vazquez-Abrams
  • 44,857
  • 7
  • 93
  • 100
8

There is only one command you have to get bash-completion:

yum install epel-release.noarch bash-completion.noarch
DShost
  • 221
  • 2
  • 2
4
  1. Download the bash-completion RPM

    wget http://www.caliban.org/files/redhat/RPMS/noarch/bash-completion-20060301-1.noarch.rpm

  2. Install the RPM

    rpm -ivh bash-completion-20060301-1.noarch.rpm

  3. Execute the command

    . /etc/bash_completion

  4. Now you can try the autocompletion

    yum ins — [TAB][TAB]

Edit: for Centos 6, you can grab this RPM

Kevin
  • 40,087
  • 16
  • 88
  • 112
iDon
  • 41
  • 2
1

If you don't have EPEL installed then first run:

yum install epel-release

Then run the following command:

yum install bash-completion --enablerepo=epel

After installation you have to logout/login in order for it to start working. To start using it in the current session, source it with the . command:

. /etc/bash_completion
isapir
  • 418
  • 4
  • 11