Saturday, October 25, 2008

Howto find Disk usage of Packages in ubuntu

The following command help you to find the disk space used by different packages in ubuntu

open a terminal window and run the command

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}'

That will sort the packages by size, putting the largest ones on the bottom.

you can pipe(|} the output for last 10 by using | tail -n 10 at the end of the command


Anonymous said...

I had to insert \t${Status} to get it to work on Debian (mixed etch/lenny). Extremely useful to find out how to best free up some disk space. Thanks!

shibuvarkala said... see this link