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

About Amit Agarwal

1 Trackback on “Removing duplicate RPMS.”