I am trying to figure out the syntax to use to search installed rpms by a specific Vendor in Linux. I was ideally just trying to use the rpm -qi grepping for a specific vendor but that doesn't seem to work. Anyone have the syntax for this search?

  • I am looking for a way to query installed rpms that could have licensing associated with it - for example IBM or Oracle. What other approach could I take? – lorrie82 Feb 18 at 15:57

You can show packages by vendor using a query format. I'd consider something like this, to list all packages:

rpm -qa --queryformat '%{vendor}:%{name}\n' | sort > packages.txt

You can then inspect the packages.txt file, which will look something like this, and will be sorted by vendor:

Codership Oy:galera
Fedora Project:certbot
Fedora Project:clang
Fedora Project:epel-release
Red Hat, Inc.:acl
Red Hat, Inc.:aic94xx-firmware
Remi Collet:php-cli
Remi Collet:php-common

Or you can just grep instead if you know what you're looking for.

rpm -qa --queryformat '%{vendor}:%{name}\n' | grep 'Red Hat'

But querying the rpmdb takes some time, so it's faster to dump the whole thing to a file and then read or grep the file.

grep 'Red Hat' packages.txt

For extra bonus points, try the query format '%{vendor}:%{name}:%{license}\n' which will append the license information from each RPM.

Red Hat, Inc.:acl:GPLv2+
Red Hat, Inc.:aic94xx-firmware:Redistributable, no modification permitted
  • thanks this looks like what I can use. – lorrie82 Feb 18 at 16:11

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.