EL7
This should be equivalent to yum list installed
, but with machine-readable output:
repoquery --installed '*' --queryformat='%{name} %{evr} %{ui_from_repo}' | column -t
Apparantly it's too much trouble to produce a man page listing the possible fields; but you can look through https://github.com/rpm-software-management/yum/blob/master/yum/packages.py and use whatever properties exist for the class of object you're listing.
e.g., if you're listing installed packages, you can use the fields of YumInstalledPackage
, and hence the fields of its base classes YumHeaderPackage
, YumAvailablePackage
, PackageObject
and RpmBase
.
Here's an example:
$ repoquery --installed '*' --qf='%{name} %{evr} %{ui_from_repo}' | head -n 10 | column -t
GeoIP 1.5.0-14.el7 @rhos-13.0-rhel-7-signed
MySQL-python 1.2.5-1.el7 @rhos-13.0-rhel-7-signed
NetworkManager 1:1.18.0-5.el7 @anaconda/7.7
NetworkManager-config-server 1:1.18.0-5.el7 @anaconda/7.7
NetworkManager-libnm 1:1.18.0-5.el7 @anaconda/7.7
NetworkManager-team 1:1.18.0-5.el7 @anaconda/7.7
NetworkManager-tui 1:1.18.0-5.el7 @anaconda/7.7
OpenIPMI 2.0.27-1.el7 @rhos-13.0-rhel-7-signed
OpenIPMI-libs 2.0.27-1.el7 @rhos-13.0-rhel-7-signed
OpenIPMI-modalias 2.0.27-1.el7 @rhos-13.0-rhel-7-signed
It's worth reading the comment that documents the ui_from_repo
property, in order to understand the possible format of this field.
EL8 & EL9
I found that adding --installed
caused the value of the ui_from_repo
to become @System
. But there is a from_repo
field that seems to work.
(It turns out valid fields can be output with dnf repoquery --querytags
).
$ dnf repoquery --installed '*' --qf='%{name} %{evr} %{from_repo}' | head -n 10 | column -t
389-ds-base 1.4.3.16-19.module+el8.4.0+11894+f5bb5c43 rhel-8-for-x86_64-appstream-rpms
389-ds-base-libs 1.4.3.16-19.module+el8.4.0+11894+f5bb5c43 rhel-8-for-x86_64-appstream-rpms
NetworkManager 1:1.30.0-10.el8_4 rhel-8-for-x86_64-baseos-rpms
NetworkManager-libnm 1:1.30.0-10.el8_4 rhel-8-for-x86_64-baseos-rpms
NetworkManager-team 1:1.30.0-10.el8_4 rhel-8-for-x86_64-baseos-rpms
NetworkManager-tui 1:1.30.0-10.el8_4 rhel-8-for-x86_64-baseos-rpms
PackageKit 1.1.12-6.el8 rhel-8-for-x86_64-appstream-rpms
PackageKit-glib 1.1.12-6.el8 rhel-8-for-x86_64-appstream-rpms
abattis-cantarell-fonts 0.0.25-6.el8 rhel-8-for-x86_64-appstream-rpms