Bash Completion Incomplete on CentOS 7 – Troubleshooting Guide

autocompletebashcentos

I have installed bash completion using yum install --enablerepo=epel bash-completion. While it works for some basic commands (git & yum), I am missing a large part of the completers.

My /etc/bash_completion.d contains the following:

bash_completion.d]$ ls
git iprutils redefine_filedir yum
yummain.py yum-utils.bash

However, I know there is bash_completion for i.e. make (which is installed) and a lot more, compare i.e. to the sample output here.

How can I get the missing completer scripts? (Preferably with yum, so I do not have to update them manually)

If it matters: tab completion works, but I am not sourcing anything in my .bashrc. It just started working after installing the package.


UPDATE: After checking the version of bash completion I have installed as @fduff suggested I saw the following:

$ yum list installed | grep completion
bash-completion.noarch 1:2.1-6.el7 @base

However trying uninstalling it and forcing centos to install bash_completion from the epel repository with sudo yum install --enablerepo=epel bash-completion --disablerepo=base yielded package not found.

Further checking yielded that the new package which is now in @base puts the completion files into /usr/share/bash-completion/completions, however I am still missing some, i.e. ssh and sudo (kind of sucks that sudo command [tab] does not complete while command [tab] does), furthermore I sitll can't find the bit for make (which should list the targets that are in Makefile)


UPDATE2:
The changelog states:

  • Fri Nov 01 2013 Petr Stodulka – 2.1-6
    • Install only available completions (#810343 – comment 15)
      without "tar" and remove the other.
  • Fri Sep 13 2013 Roman Rakus – 2.1-5
    • Added one more missing conditional
      Resolves: #1007839
  • Fri Sep 13 2013 Roman Rakus – 2.1-4
    • Added conditionals to not add completions for some commands; the packages
      has their own completions
      Resolves: #1007839

Thus reinstalling sudo, after I had bash_completion installed worked for the sudo completion, however I had no such luck with make.

QUESTION: How to enable make bash completion in Centos 7?

Best Answer

You might want to try bash-completion-extras. It was briefly only in epel-testing, but has been released into epel. Right now, you should be able to run:

yum --enablerepo=epel install bash-completion-extras

...to get bash-completion-extras.

Related Question