If you want to know the size and name of all the rpm’s that are installed on your system then use the following command :

#rpm -qia|awk ‘$1==”Name” { n=$3} $1==”Size” {s=$3} $1==”Description” {print s  ” ” n }’ |sort -n

1.) rpm -qia will list all installed rpms along with their all Info.
2.) send above output to awk. It will see if first column is “Name”, then set value of Third column to n(variable).Similarly, If first column is “Size”, then set value of Third column to s(variable).

Note : If you just run rpn -qia then you will see that the row Having Name as first column have third column as its Actual Name and same with Size.

3.) Finally It Print Value of “s” and “n” variable and sort them in ascending order.

Posted in: Linux.
Last Modified: November 19, 2013

Leave a reply