[Scottish] RPM sizes

Paul Millar scottish at mailman.lug.org.uk
Thu Dec 5 17:59:01 2002


Hi everyone,

This would be an entry for the Scripts and Tips, but the new webpage 
doesn't seem to have those any more :(

I was trying to find out what RPMs were taking so much space (common
problem after a RH install). AFAIK, rpm doesn't support listing all
packages in size order, so I did:

c=0;rpm -qai|egrep '^Size +:|^Name +:'|awk '{print $3}'| while read f; do 
if [ $c -eq 1 ]; then echo $f $name; c=0; else name=$f; c=1; fi; done|sort -n

as a quick one-liner.  I'm sure anyone who knows Perl can do it much more 
easily :)

If you want to alias it, you have to be a bit careful of the ``$''s ...  

alias rpm-list="c=0;rpm -qai|egrep '^Size +:|^Name +:'|awk '{print \$3}'| 
while read f; do if [ \$c -eq 1 ]; then echo \$f \$name; c=0; else name=\$f; 
c=1; fi; done|sort -n"

Cheers,

Paul.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Particle Physics (Theory & Experimental) Groups                   Paul Millar 
Department of Physics and Astronomy                     paulm@astro.gla.ac.uk
University of Glasgow                                 paulm@physics.gla.ac.uk
Glasgow, G12 8QQ, Scotland             http://www.astro.gla.ac.uk/users/paulm 
+44 (0)141 330 4717        A54C A9FC 6A77 1664 2E4E  90E3 FFD2 704B BF0F 03E9
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --