How to list packages you have explicitly installed using yum

If you’re after a way to list all the packages you have explicitly installed (rather than packages that have been pulled in as a dependency) then you can do that with yumdb (thanks to Panu on #yum for the tip) which is powered by a new database added in 2009.

List packages you chose to install:
yumdb search reason user

List packages which were installed as deps:
yumdb search reason dep

Let’s go through an example, installing gnash which pulls in a few deps on my system:
Installed:
gnash.x86_64 1:0.8.10-8.fc19
 
Dependency Installed:
agg.x86_64 0:2.5-16.fc19 boost-iostreams.x86_64 0:1.53.0-6.fc19 boost-serialization.x86_64 0:1.53.0-6.fc19 gtkglext-libs.x86_64 0:1.2.0-18.fc18 pangox-compat.x86_64 0:0.0.2-2.fc19

As you can see, I got 5 dependencies, so let’s check whether yumdb got it right:
yumdb search reason dep |egrep "agg|boost-iostreams|boost-serialization|gtkglext-libs|pangox-compat"
 
agg-2.5-16.fc19.x86_64
boost-iostreams-1.53.0-6.fc19.x86_64
boost-serialization-1.53.0-6.fc19.x86_64
gtkglext-libs-1.2.0-18.fc18.x86_64
pangox-compat-0.0.2-2.fc19.x86_64

Yep, looks good. What about gnash?
yumdb search reason user |grep gnash
 
1:gnash-0.8.10-8.fc19.x86_64

Update:
Some people have written in to say the command shows packages that they never explicitly installed, things like ModemManager and firware packages.

I think the reason for this is that yumdb is including default and mandatory packages from when you install a group. I guess that makes sense, if you install a group then you’re telling it you want all of the packages there (but you shouldn’t get any deps).

For example, most systems probably have @hardware-support group installed, which is where ipw220-firmware comes from:
$ sudo yum groupinfo hardware-support |grep ipw2200
=ipw2200-firmware

Similarly, for ModemManager, it’ll be part of default @dial-up group.
$ sudo yum groupinfo dial-up |grep Modem
=ModemManager

So only way around this I can see is to not install groups, because installing a group tells it to install whatever is in the list.

It would be great if yumdb supported “group” type..

-c

19 thoughts on “How to list packages you have explicitly installed using yum

  1. Man this is totally awesome! Next time upgrade time comes around, I’m definitely going to be doing this to audit what packages I installed!

  2. I see a lot of packages that I didn’t explicitly install. It looks like it is including the default Fedora packages in the list as well?

  3. For real?

    yumdb search reason user
    ….
    zd1211-firmware-1.4-6.fc17.noarch
    reason = user
    ….

    I don’t even know what that is, there’s no way in hell I installed that myself. there’s about 500 results to this query on my fc17 system, and there’s no way I manually installed even half of them.

  4. I modified the query to be:

    $ yumdb search command_line install*

    This returned all packages that I installed, but doesn’t let me filter based on if the packages were explicitly installed or if they were dependencies.

    If only we could include multiple keys in the search…

    (BTW, Hi Chris! I didn’t even realize it was your blog when I posted my first reply πŸ™‚ You were on the Fedora start page for Firefox)

  5. This doesn’t seem to work the way I expected. It outputs stuff like:

    ModemManager-0.6.0.0-3.fc18.x86_64
    reason = user

    which I am quite certain I never asked to install, or

    ipw2200-firmware-3.1-7.fc18.noarch
    reason = user

    which makes no sense since I don’t have a wireless card. Maybe it’s treating stuff pre-installed on the LiveUSB as “installed” by the user?

  6. Hey Jon, long time no see!

    I think it may be including default and mandatory packages from when you install a group. I guess that makes sense, if you install a group then you’re telling it you want all of the packages there (but you shouldn’t get any deps). Might need some more investigation though..

    Cheers,
    -c

  7. I think it may be including default and mandatory packages from when you install a group? I guess that makes sense, if you install a group then you’re telling it you want all of the packages there (but you shouldn’t get any deps). Not 100% sure though..

    -c

  8. Could be, although the live image is just copied to the disk to it’ll be the same as whatever packages were specified in the kickstart that created the image.

    My guess is that it’s including default and mandatory packages from when you install a group. I guess that makes sense, if you install a group then you’re telling it you want all of the packages there (but you shouldn’t get any deps). For example, I’m sure that your system will have installed @hardware-support which is where ipw220-firmware came from:
    $ sudo yum groupinfo hardware-support |grep ipw2200
    =ipw2200-firmware

    Similarly, for ModemManager, it’ll be part of default @dial-up group.
    $ sudo yum groupinfo dial-up |grep ModemThere is no installed groups file.
    =ModemManager

    So only way around this I can see is to not install groups, cause installing a group tells it to install whatever is in the list.

    -c

  9. Extending from ideas already posted here, I came up with this, which gives me exactly what I needed. Thanks to all how contributed.

    yumdb search command_line install* | egrep “command_line” | egrep -v “\.rpm” | egrep -o “[^=]+$” | sed -e ‘s/ install //g; s/\s\+/\n/g’ | sort -u

  10. You could probably use awk in there instead of the sed to print the last line.

    yumdb search command_line install* | egrep "command_line" | egrep -v "\.rpm" | awk '{print $NF }' | sort -u

    Keep in mind though that if you install with something like:
    sudo yum install package -y

    Then the package you get out from your command will be “-y” πŸ™‚

Leave a Reply

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