Trying to understand RPM Query Format

Latest response

I'm trying to understand RPM Query Format, and I'm not able to get anything to return from these.

rpm -qa --qf '%{NAME} %{VENDOR}\n' | grep -v "Red Hat"

I think this RPM Query looks for and returns any third party packages.

rpm -qa --queryformat '%{name-%{version}-%{release} %{size}\n'

This is another one that I've run, however it doesn't return any results either.

Was wondering if someone could point me in the right direction and could give me some pointers on how to get better at this.



Your first rpm command: Is it possible that you do not have anything from outside Red Hat?

Your second rpm command: there is a missing } after the %{name .

Ok, so I got this to work on a server where I know that we have Third Party RPMs

[cmmiller@amedvma4aisr3200 ~]$ rpm -qa --qf '%{NAME} %{VENDOR}\n' | grep -v "Red Hat"
gpg-pubkey (none)
oracleasm-support Oracle Corporation
oracleasm-2.6.18-404.el5 Oracle Corporation
jdk1.8.0_25 Oracle Corporation
oracleasmlib Oracle Corporation
gpg-pubkey (none)

I also then ran the 2nd command successfully, had to pipe thru sort and uniq to cut it down and organize it.


Hello I was trying to understand the meaning of "%{VERSION} but I am not getting complete code is as below. VER=$(rpm -q --queryformat "%{VERSION}\n" exim)

Hi Kailas,

What do you mean by I am not getting complete code as below? If you want to see the output, add echo $VER as the next command.

VER=$(rpm -q --queryformat "%{VERSION}\n" exim) ; echo $VER

(Hint: you need a white line between two text lines to get the text on a newline.)


Jan Gerrit Kootstra

thanks I mean I was trying to understand what "%{VERSION} does mean so now I got that from rpm man page