List installed packages by size with RPM

Data always piles up and on a small VPS the storage space can quickly get consumed by leftover or unused programs.
When things get too crammed it’s time to use the available tools and clean up some of the unwanted things.

Using RPM

List all installed packages and their sizes (in bytes):

rpm -qa --queryformat '%{SIZE} %{NAME} \n'

List top 10 packages, sorted by size:

rpm -qa --queryformat '%{SIZE} %{NAME} \n' | sort -n -r | head -10

Now take your pick and remove those wasteful things which are no longer used.

View all queryformat parameters with

rpm --querytags

Leave a Reply