Get the information on all the rpms installed on the system

Here\’s a one-liner to get the info on all the packages installed on your system.

rpm -qa –info |tee All_rpms_Info

This is what it does, when you query the rpm database with the –info parameter, then the output looks something like the below, which is quite helpful.

Name        : rpm                          Relocations: (not relocatable)
Version     : 4.6.0                             Vendor: Fedora Project
Release     : 0.rc3.1.fc10                  Build Date: Sat 13 Dec 2008 12:38:24 AM IST
Install Date: Tue 13 Jan 2009 09:22:50 PM IST      Build Host: x86-5.fedora.phx.redhat.com
Group       : System Environment/Base       Source RPM: rpm-4.6.0-0.rc3.1.fc10.src.rpm
Size        : 3662666                          License: GPLv2+
Signature   : DSA/SHA1, Tue 06 Jan 2009 08:20:24 PM IST, Key ID bf226fcc4ebfc273
Packager    : Fedora Project
URL         : http://www.rpm.org/
Summary     : The RPM package management system
Description :
The RPM Package Manager (RPM) is a powerful command line driven
package management system capable of installing, uninstalling,
verifying, querying, and updating software packages. Each software
package consists of an archive of files along with information about
the package like its version, a description, etc.

So, this is probably much more useful info. All the output is displayed on the terminal as well as written in the file called All_rpms_info. 🙂

Removing duplicate RPMS.

Got the script mainly with google search on the link.

Nice trick..

Get the list of rpms with just the names
rpm -qa –queryformat \’%{name}\\n\’ > pkglist

Get the non-uniques list.
sort -g pkglist | uniq -d > duplicates

Get the versions of the duplicate files:
for pkg in `cat duplicates`; do
rpm -q $pkg >> removelist
done

Now keep the rpms that you want to delete in the removelist

and a simple command to remove them will be :
for pkg in `cat removelist`; do
rpm -e $pkg
done

View information on all the rpms installed.

This post if applicable to all the distro\’s which are based on rpm.

If you look at the number of rpms installed on your system, you will see it somewhere around 500-2000. Noe thats a pretty huge number. So sometimes I keep wondering what are these rpms for. Heres a command that can help you figure out what these rpms are for:

rpm -qa –info

And if you want to find info on all the files and put it in a file too:

rpm -qa –info |tee <filename>