Sometimes you might want to uninstall large packages on a running Linux system (e.g. in order to release disk space), since these kind of packages are normally not that useful.
Here we show an example on how to list installed packages by size on Redhat and Debian system.
On Redhat:
rpm -qa --qf '%{SIZE}\t%{NAME}\n' | sort -n
On Debian:
dpkg-query -W -f='${Installed-Size} ${Package}\n' | sort -n
The output are almost the same, as follows;
... 32677398 emacs-common 33105695 gnome-applets 34827183 selinux-policy-targeted 36128134 perl 36957293 foomatic 37665705 TrueType-fonts 51569169 valgrind 61423920 java-1.6.0-sun-devel 64042968 valgrind 66738433 glibc-common 87699759 compat-gcc-34-c++ 93664534 java-1.6.0-sun 102347862 kernel