How to list all installed packages in size order on Ubuntu

For someone to go and do some cleanup on their side project VM it might feel like a big task to keep the box clean, up to date and running smoothly.

To see a list of packages that are installed in your Ubuntu VM, run:

dpkg --list

That does not show you the size of each package yet.

dpkg-query --show --showformat='${Package;-50}\t${Installed-Size} ${Status}\n' | sort -k 2 -n |grep -v deinstall

# Outputs the packages by size from smallest to largest
google-cloud-sdk                                   87061 install ok installed

Show Comments

Get the latest posts delivered right to your inbox.