I'm trying to look at some statistics on the size of packages in the Ubuntu repositories, and I'm hoping to sort my searches of packages in the repositories by file size. Is there a command that will let me look at file sizes of packages in the repositories/cache, sort them by file size, etc? `apt-cache stats' doesn't provide all the information I'd like.
I'm interested in only the official repositories at the moment, and I'm interested in sorting all packages in the repositories, not simply the ones I have installed.
That should work:
I'm not proud of it but that was done in a bit of a hurry :)
for installed packages you can either use a oneliner:
or third-party tools like wajig:
this will give output like
for searches something like this might help:
This gives output like:
the %I shows the "installed" size of the archive. Now you have the ability to use sort to sort the results as you wish.
An alternative to Marcin's solution is this oneliner (only tested in
zsh
):apt-cache dumpavail \ | sed -nE '/^(Package|Size):/s/.* //p' \ | while read name; do read size echo $size $name done \ | sort -nr
It has the dubious advantage of only using
sed
andsort
, not alsogrep
andawk
. :)