====== Ubuntu - Packages - Find Large Packages ======
Issue this command:
dpkg --get-selections | cut -f1 | while read pkg; do dpkg -L $pkg | xargs -I'{}' bash -c 'if [ ! -d "{}" ]; then echo "{}"; fi' | tr '\n' '\000' | du -c --files0-from - | tail -1 | sed "s/total/$pkg/"; done | sort -rn > ~/packages.log.txt
If you run this as root, when its finished you will have a file in /root called **packages.log.txt** which has all the packages from your system in it with the size of the package and the files it uses:
15312 perl-modules
14192 php5-cgi
12588 perl
12400 coreutils
12396 iso-codes
11232 aptitude
10684 binutils
9916 python2.5
You can also use something like:
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
but this also takes the size of databases and extra files.