YUM Autocomplete on Fedora, CentOS, Red Hat (RHEL)

This is quick tip, howto use Bash auto complete (autocomplete) with YUM (example) on Fedora, CentOS, Red Hat (RHEL).

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 YUM and also with RPM.

1. Install bash-completion

1.1 Change to root

su -
## OR ##
sudo -i

1.2 Install bash-completion package with YUM

yum install bash-completion

1.3 Logout console

Then logout console or close command line and log back in.

2. Autocomplete usage

[TAB] = press tab/tabulator

2.1 YUM commands

Example 1

[root ~]$ yum in[TAB][TAB]
info     install
 
[root ~]$ yum ins[TAB]  ## and you get "yum install"

Example 2

[root ~]$ yum s[TAB][TAB]
search  shell
 
[root ~]$ yum se[TAB]  ## and you get "yum search"

2.2 YUM packages

Example 1

[root ~]$ yum install fire[TAB][TAB]
firebird-classic.i686      firebird.i686              firecontrol.i686
firebird-devel.i686        firebird-libfbembed.i686   firehol.noarch
firebird-doc.i686          firebird-superserver.i686  firewalk.i686
 
[root ~]$ yum install fireh[TAB]  ## and you get "yum install firehol.noarch"

Example 2

[root ~]$ yum remove ge[TAB][TAB]
gedit.i686           geoclue-devel.i686   geronimo-jms.noarch  gettext.i686
gegl.i686            geoclue.i686         geronimo-jta.noarch  gettext-libs.i686
genisoimage.i686     GeoIP.i686           gettext-devel.i686
 
[root ~]$ yum remove gen[TAB]  ## and you get "yum remove genisoimage.i686"

Note: If you run this without any letter then it might take very very long time.

Follow If Not True Then False Updates!

6 Comments

  1. Nice!
    I love this blog :)

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

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

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

        • Nice one…I agree… :D

Leave a Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks/Pingbacks

  1. Autovervollständigung für Terminal-Befehle « linux|n00b - [...] "If Not True Then False" findest du eine kurze Erläuterung sowie Installationsanleitung für bash-autocomplete, welches genau das bereinigt. Zu ...