List all the rpms by size – quick way to find out what is eating your disk space in root partition

Here is a quick command to check the list of installed packages by their size in reverse order. Very useful if you want to remove unwanted rpms just to clean up some space on your disk:

1
rpm -q -a --qf "%10{SIZE}\t%{NAME}\n" | sort -k1,1nr |more

Sample output:

78070452    kernel
78060477    kernel
50708634    jre
50316408    libgcj
48581593    wireshark
47778643    gimp
47674675    jre
47303084    qt-x11
45838912    otrs
45657248    chromium-libs
42070128    wxPython

Quick tip on zipping logs in real time.

Sometimes, some small things that we don’t actually think can be useful are such useful. I faced this couple of days back when I was working on something and the amount of logs getting generated and the files getting rotated was too fast. If I had to use this for sometime, I needed some script, application or something to make sure that the logs are zipped every few seconds. Finding an application for this would take time and what good is bash if we need to find applications for this. So, a simple bash command did the trick. Most of us would know this but applying it and using it at the right time, was what saved my life. Thanks to bash. Here is the command:

1
2
3
4
5
6
7
8
9
for i in *.log

do

gzip $i

sleep 5

done

Can it get simpler than this 🙂