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

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

1 thought on “Removing duplicate RPMS.”

This site uses Akismet to reduce spam. Learn how your comment data is processed.