You are not logged in.

#1 2009-08-15 19:56:23

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

[Script] List packages by installed size. Useful to free HD space

Hi,

Here's a small script that sort the installed packages by decreasing installed size. It's useful to find unused packages that take lots of HD space when doing a system clean-up. I believe there was  a similar script a couple or years ago in the forums but I couldn't find it so I made one. There might be better ways to do that (like getting the info straight from the local db instead of using pacman) but I didn't want to spend too much time on it.

#!/bin/bash
# Sort installed packages by decreasing installed size. Useful for system clean-up.

for package in $(pacman -Qq); do
    echo $(pacman -Qi $package |grep 'Installed Size' |awk '{print $4 " " $5}') : $package
done |sort -g -r

EDIT: removed unecessary pipe to awk

Offline

#2 2009-08-15 21:22:42

Heller_Barde
Member
Registered: 2008-04-01
Posts: 245

Re: [Script] List packages by installed size. Useful to free HD space

you could use pacgraph smile it's even more suited, because it lists toplevel packages instead of also packages that are only dependencies
(but then again, you probably knew that already, being a dev/mod)

EDIT: you could use "pacman -Qq" instead of the piping into awk on the first line

Last edited by Heller_Barde (2009-08-15 21:24:15)

Offline

#3 2009-08-16 05:35:13

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: [Script] List packages by installed size. Useful to free HD space

Heller_Barde wrote:

you could use pacgraph smile it's even more suited, because it lists toplevel packages instead of also packages that are only dependencies
(but then again, you probably knew that already, being a dev/mod)

I wasn't aware of pacgraph. I don't visit much the forum anymore. It looks like a cool tool. But it seems to me that, for package cleanup,  it is more convenient to have the packages listed in a single column than having to examine a figure.  I'll probably give it a try next time I need to do some cleanup.

Heller_Barde wrote:

EDIT: you could use "pacman -Qq" instead of the piping into awk on the first line

Thanks. I did the change in the script. I never used the -q option before. That's why I didn't used it. tongue

Offline

#4 2009-08-16 05:38:05

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: [Script] List packages by installed size. Useful to free HD space

This does something similar to pacgraph but without the graph:
http://bbs.archlinux.org/viewtopic.php?id=73098

Offline

#5 2009-08-16 05:42:48

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: [Script] List packages by installed size. Useful to free HD space

Allan wrote:

This does something similar to pacgraph but without the graph:
http://bbs.archlinux.org/viewtopic.php?id=73098

The name tells me something.  That might be the script I had in mind but couldn't find. roll

Offline

#6 2009-08-23 17:37:04

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: [Script] List packages by installed size. Useful to free HD space

You could still use Pacgraph.  It has a "without the graph" mode, --console.  Or just -c.
pacgraph --console
will generate the single column of stats you want.

Offline

#7 2009-08-23 18:19:07

plurt
Member
Registered: 2008-10-16
Posts: 88

Re: [Script] List packages by installed size. Useful to free HD space

+1 to pacgraph -c

Why reinvent the wheel? smile


When everything's coming your way, you're in the wrong lane I say.
FAQ / Beginners Guide / The Arch Way

Offline

Board footer

Powered by FluxBB