DNF/YUM Autocomplete (package names/commands) on Fedora/CentOS/RHEL - Comment Page: 1

This is quick tip, howto use Bash auto complete (autocomplete) with DNF/YUM (package names/commands) on Fedora, CentOS, Red Hat (RHEL). Dnf package manager is used on Fedora 26/25/24/23/22 and Yum package manager is used on Fedora 21/20/19/18, CentOS 7.3/6.9 and Red Hat (RHEL) 7.3/6.9. Autocomplete feature is familiar to many who have used the Debian based Linux, like Debian and Ubuntu. For some reason, this feature is not automatically activated/installed on Red Hat -based Linux distros, like Fedora, CentOS and Red Hat (RHEL). Actually auto completion works with any Bash programs, but I think it's very useful example with DNF/YUM and also with RPM. You can autocomplete DNF/YUM commands...

14 comments on “DNF/YUM Autocomplete (package names/commands) on Fedora/CentOS/RHEL - Comment Page: 1

    • Hi Jacob,

      The problem is that the yum completion uses yum -C … which uses the root cache. This same issue is also reported as bug and might be fixed later by yum developers.

      So currently best and only way to use it is just change to root user and use autocomplete then.

      • “So currently best and only way” … that’s a provocative statement for an open source software. As I don’t find completion for my centos (centos first time user) I don’t dare to post a solution here but fixing it yourself is definitely a way and proves the statement wrong ;)

  1. I have bash-completion installed on my Fedora 16 and its the latest version.
    How ever i am able to tab-complete “Yum commands” but i cannot tab-complete “Yum Packages”.
    Do you know how to resolve this issue.

    • Hi Abhijeet,

      Are you trying completion as normal user or root user?

      Btw, it’s maybe time to upgrade your whole system, example to Fedora 19.

  2. Just wanted to say that my fedora 18 do autocomplete. I didn’t need to install it.
    But this is a great tip. As a lazy person, I love autocomplete hahaha

  3. On Fedora 26 with dnf-plugins-core-2.1.3-1.fc26.noarch and python3-dnf-plugins-core-2.1.3-1.fc26.noarch installed I still do not see bash completion for plugins.

    try: sudo dnf b
    You should get options including “builddep” but there is no completion.

    FWIW, Debian/Ubuntu have working completion for: sudo apt-get build-dep

  4. I have Fedora 26 installed from Live download. Before I can run the above commands, I have to fix error: “Error: Failed to synchronize cache for repo ‘updates'” I get this error running yum command or dnf command. I also do not see a /etc/yum.conf file. I have read and tried many “fixes” but still blocked/failed.

Leave a Reply

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