Sort Installed .deb Packages by Size

GUI options

The easy GUI way is to use Synaptic and enable the "Installed Size" column by going to Settings → Preferences → Columns and Fonts.

You can then go to the "Status" filters and select the "Installed" filter then click on the column you want to sort by. It's interestingly called just "Size" instead of "Installed Size".

Command Line Options

#!/bin/bash
perl -ne '$pkg=$1 if m/^Package: (.*)/; print "$1\t$pkg\n" if m/^Installed-Size: (.*)/;' < /var/lib/dpkg/status | sort -rn | less

or using dpkg-query:

#!/bin/bash
dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n | grep -v deinstall | awk '{printf "%.3f MB \t %s\n", $2/(1024), $1}'

Using a dedicated piece of software: wajig which can list large (>10MB) installed packages:

sudo apt-get install wajig
wajig large

or using dpigs:

sudo apt-get install debian-goodies
dpigs -n 10

Resources

Comments