Recently I have come in situation having low space. So I start thinking that how will I got the list of all RPM installed along with their size. So I have spend some time for searching and got the following nice command.
#rpm -qia|awk '$1=="Name" { n=$3} $1=="Size" {s=$3} $1=="Description" {print s " " n }' |sort -n
Let me explain the above thing
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.
Kuldeep
!Enjoy Linux
#rpm -qia|awk '$1=="Name" { n=$3} $1=="Size" {s=$3} $1=="Description" {print s " " n }' |sort -n
Let me explain the above thing
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.
Kuldeep
!Enjoy Linux
No comments:
Post a Comment