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...

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

    1. […] "If Not True Then False" findest du eine kurze Erläuterung sowie Installationsanleitung für bash-autocomplete, welches genau das bereinigt. Zu installieren ist lediglich […]

      Reply
    2. Nice!
      I love this blog :)

      Reply
    3. Very simple tip and very useful.
      Thanks for the explanation!

      Reply
    4. I already had the package installed, not sure from what, but it will only autocomplete if I am su and not my normal user. Any reason for that?

      Reply
      • 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.

        Reply
        • “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 ;)

          Reply
    5. 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.
      Thanx.

      Reply
      • 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.

        Reply
    6. 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

      Reply
    7. This is helpfull for the beginners like me… :D

      Reply
    8. 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

      Reply
    9. 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.

      Reply
      • Hi,

        Try run following command first:

        dnf clean all
        Reply
    10. is installed by defautl on fedora 28 workstation, now how enable on dnf list simple[TAB] , dnf search srcre[TAB] like ubuntu.

      Reply
      • Hello Tony,

        Yes, but this isn’t always case with minimal Fedora, RHEL and CentOS server setups.

        Reply

Leave a Reply to Abhijeet Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close