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:

Shell
yumdb search reason user

List packages which were installed as deps:

Shell
yumdb search reason dep

Let’s go through an example, installing gnash which pulls in a few deps on my system:

Text
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:

Shell
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?

Shell
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:

Shell
$ sudo yum groupinfo hardware-support |grep ipw2200
   =ipw2200-firmware

Similarly, for ModemManager, it’ll be part of default @dial-up group.

Shell
$ 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