I had to do a little cleaning up recently on a system that was critically low on disk space on the root filesystem.
I had to remove something, so I wanted to find some .deb packages that were safe to remove but also would actually free up some space.
In Debian GNU/Linux, you can get an overview of all installed packages ordered by the amount of disk space they each consume with the following command:
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
The command dpkg-query -Wf '${Installed-Size}\t${Package}\n'
:
lists all installed packages along with their installed sizes in a
tab-separated format.
${Installed-Size}
represents the size of each package in
kb, and ${Package}
represents the package name.
Here is a sample output from my current workstation:
$ dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n |tail -n 20
263030 linux-image-4.19.0-10-amd64
263216 linux-image-4.19.0-11-amd64
263251 linux-image-4.19.0-12-amd64
263620 linux-image-4.19.0-14-amd64
263632 linux-image-4.19.0-13-amd64
263729 linux-image-4.19.0-16-amd64
263783 linux-image-4.19.0-17-amd64
263853 linux-image-4.19.0-18-amd64
263927 linux-image-4.19.0-25-amd64
263960 linux-image-4.19.0-19-amd64
263964 linux-image-4.19.0-20-amd64
264013 linux-image-4.19.0-21-amd64
264067 linux-image-4.19.0-22-amd64
264115 linux-image-4.19.0-23-amd64
264143 linux-image-4.19.0-24-amd64
270589 fonts-noto-extra
319056 texlive-lang-japanese
339904 zettlr
1101775 texlive-fonts-extra
2044173 0ad-data