Friday, April 30, 2010

linux: how to see which packages are taking the most disk space

Here's a little scriptfoo that's very useful when you're running out of disk space. When you need to reclaim hard drive real estate urgently by removing those useless "Engineering and Scientific" packages, run diskhoggers. Of course, it only works on RPM-based systems, so it's useless on Ubuntu/Debian etc, but there should be equivalents (e.g. using dpkg and/or synaptic apt-get) on those systems too.

alias diskhoggers='rpm -qa --qf "%10{SIZE}\t%{NAME}\n" | sort -n' 


Here's an example run on my system:

[root@noumPC ~]# diskhoggers | tail -n 30
15370931 bcel
15585349 gutenprint
15615584 gnome-applets
16021416 gcc
16574947 webkitgtk
16742780 nautilus
17773959 vim-common
18113087 firefox
18147692 libgweather
19693980 libicu
20174285 python
20250203 ghostscript
22082141 fedora-release-notes
22312309 kernel-devel
22371021 python-lxml
24697430 xulrunner
25032963 foomatic-db-ppds
25455524 libpurple
26376798 eclipse-jdt
29624088 perl
32984533 eclipse-platform
46820396 qt-x11
49233851 google-chrome-beta
49484310 valgrind
50371329 libgcj
80240654 kernel
84381565 kernel
85572888 java-1.6.0-openjdk
111799012 glibc-common
246952321 java-1.5.0-gcj-javadoc

No comments: