List full name of rpm packages installed

Sometimes when checking on installed Red Hat packages it’s helpful to see the full package name, especially when you’re trying to distinguish between x86 and x86_64 versions. Here’s a handy one-liner for that:

rpm -q [PACKAGE_NAME] –qf “%{name}-%{version}-%{release}\
.%{arch}\n”

What this will get you is something like this:

rpm -q glibc --qf "%{name}-%{version}-%{release}.%{arch}\n"
glibc-2.5-24.x86_64
glibc-2.5-24.i686

If you need to check a bunch of similarly named packages at one, you could use the -qa switch and combine with a pipe (” | “) to grep and get something like this:

rpm -qa --qf "%{name}-%{version}-%{release}.%{arch}\n"\
| grep openldap
openldap-devel-2.3.27-8.el5_2.4.i386
openldap-2.3.27-8.el5_2.4.x86_64
openldap-servers-2.3.27-8.el5_2.4.x86_64
openldap-clients-2.3.27-8.el5_2.4.x86_64
openldap-devel-2.3.27-8.el5_2.4.x86_64
openldap-2.3.27-8.el5_2.4.i386