You are not logged in.

#1 2006-04-26 09:42:04

pholie
Member
Registered: 2005-06-04
Posts: 234

little script which lists sizes of all installed packages

I needed to find out how much disk space do my installed packages use so I could uninstall those which take a lot of space but in fact I don't need them anymore. The shell script just parses pacman's output thus it is relatively slow. I may add functions like sorting by size or displaying sizes in MiB instead of Bytes.

for package in `pacman -Q|awk '{ print $1}'`; do pacman -Qi $package|grep -e Name -e Size|awk '{print $3}'|awk '{getline s; print $0 " " s;}'; done

The output format is very simple:

a2ps 2650067
a52dec 126230
abiword 11195890
acl 314972
acpid 71548
alsa-lib 1569288

Maybe completely rewriting it to directly parse 'desc' files in /var/lib/pacman/local would be better, I'll consider using C or python instead.

Suggestions?

Offline

#2 2006-04-26 10:41:41

FUBAR
Member
From: Belgium
Registered: 2004-12-08
Posts: 1,029
Website

Re: little script which lists sizes of all installed packages

Ooooh, sounds (and looks) neat. Although there might be discrepancies between the size reported in the pacman database and the actual size. Not sure about that, though.


A bus station is where a bus stops.
A train station is where a train stops.
On my desk I have a workstation.

Offline

#3 2006-04-26 19:42:28

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: little script which lists sizes of all installed packages

You could probably speed things up a tad by using 'cut' instead of 'awk'

Offline

#4 2006-04-27 07:00:55

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Re: little script which lists sizes of all installed packages

And perhaps make it display in kb? Although that's a simple matter.

I'd like to see the total size, too :-)

Offline

#5 2006-07-23 10:02:31

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 671
Website

Re: little script which lists sizes of all installed packages

pholie wrote:

Great, your script is much faster than mine smile. I knew I had to do this by reading desc files directly but I did not find enough time to do it.

+1  smile

Would having pacsize sorting by size be feasable ?


Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

Board footer

Powered by FluxBB