Re: listing packages in order of size
Drew Parsons decía:
> So, I did the proper thing and wrote my own utility.
So did I. If anyone is interested, here it is. It's two sh scrpits, that I
place under /usr/local/bin/:
------------------------calcula-size------------------------------
#!/usr/bin/perl -w
# 'calcula-size', ireleased under GNU GPL lisence
# Author: Javier Fernandez-Sanguino Peña <jfs@computer.org>
# Package list can be created with:
# ^Dpkg -l \"*\" |grep ^ii | cut -f 3 --delimiter=" " > package;
# But we'll just read DPKG_AVAILABLE ti see which packages are available
# and their size, so
$DPKG_AVAILABLE='/var/lib/dpkg/status';
open (DPKG,$DPKG_AVAILABLE);
while (<DPKG>)
{
# print ;
if ( /^Package:(.*)$/ )
{ $pack_name=$1; }
if ( /^Installed-Size:(.*)$/ )
{ $pack_size=$1;
$packs{$pack_name}=$pack_size;}
}
foreach $pack_name (keys %packs)
{ print "$packs{$pack_name}\t$pack_name\n";}
close DPKG;
# You can sort the list up with:
# sort -nr -k 1 |less;
exit 0;
--------------------quetengo---------------------------------------
#!/bin/sh
echo "#######################" > tmp_quetengo
echo "Installed deb packages " >> tmp_quetengo
echo "#######################" >> tmp_quetengo
echo "" >> tmp_quetengo
echo "My hard drive is this full:" >> tmp_quetengo
df -h /dev/hdc1 >> tmp_quetengo
echo "" >> tmp_quetengo
echo "Kbytes Package" >> tmp_quetengo
echo "------ -------" >> tmp_quetengo
calcula-size | sort -nr -k 1 >> tmp_quetengo
less tmp_quetengo
rm tmp_quetengo
I also made some changes so that packages were listed in alphabetical order,
given certain option, but I am not on that machine at this moment (sorry).
Hope it helps.
BTW, does anyone know about a scripts repository so that I can improve mine?
Kind regards
--
The most secure computer is the one that's turned off, unplugged, encased in
concrete and sunk in the atlantic. It's useabilty does suck, though.
-------------------------------------------------------------------------------
Barbwired (The Translatrix) - U. Complutense de Madrid - Filología Inglesa
Web personal http://www.bigfoot.com/~barbwired/
Proudly running Debian GNU/Linux 2.1 (Kernel 2.2.12) on a Dell Laptop
Reply to: