RPM queries

packageAfter I read about bug 211941 which installs the wrong architecture kernel on the machine I wondered how you can query a package in a way that it shows you the architecture as well.

First of all, the solution is pretty easy:

rpm -q --queryformat '[%{name}-%{version}-%{release}.%{arch} \n]' kernel

But as you can see there are other possibilities hidden in this line – you can combine the arguments as you wish, and you can add more: with rpm --querytags|sort you get a complete (sorted) list of all possible values you can query. And as you can see you can also sort them a bit: \n gives you a new line and \t a tab space.

This is nothing new, by the way, but I never wrote it down to have a real overview.