So today I would share a small tip on how to check the version of the RPMs that you have already installed on your servers. So, when I mean version it means to find whether the RPM is a 32,64 bit or noarch version. Thanks to the doubt from my friend I always get to learn something new J

So the command is “rpm -qa -qf <QUERY TAGS>

Where the Query tags are

n – name

arch – architecture

v-version

r- release

[root@redhat6pc ~]# rpm -qa –qf “%{n}-%{arch}\n” | grep -i libaio

libaio-x86_64

[root@redhat6pc ~]# rpm -qa –qf “%{n}-%{v}-%{r}.%{arch}\n” | less

Or

rpm -qa –queryformat “%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})

[root@redhat6buildpc~]  rpm -qa –qf “%{n}-%{v}-%{r}.%{arch}\n”

plymouth-plugin-label-0.8.3-24.el6.x86_64

nano-2.0.9-7.el6.x86_64

tzdata-2011l-4.el6.noarch

liberation-fonts-common-1.05.1.20090721-4.el6.noarch

perl-URI-1.40-2.el6.noarch

If you want you can redirect the output to a file and save the Info as below in a file

[root@redhat6pc ~]# rpm -qa –queryformat “%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n” > /tmp/rpmlist.txt

[root@redhat6pc ~]# more /tmp/rpmlist.txt

plymouth-plugin-label-0.8.3.24.el6 (x86_64)

perl-Module-Load-0.16.119.el6_1.1 (x86_64)

xorg-x11-drv-rendition-4.2.4.1.el6 (x86_64)

cdparanoia-10.2.5.1.el6 (x86_64)

nano-2.0.9.7.el6 (x86_64)

tzdata-2011l.4.el6 (noarch)

Advertisements