9

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?

lorrie82
  • 93
  • 3
  • 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 '19 at 15:57

1 Answers1

9

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
...
(none):gpg-pubkey
(none):nginx
...
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
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972