How to list the contents of a package using YUM?
fedora, linux, package-managers, rpm, yum
Solution
There is a package called `yum-utils` that builds on YUM and contains a tool called `repoquery` that can do this.
$ repoquery --help | grep -E "list\ files"
-l, --list list files in this package/group
Combined into one example:
$ repoquery -l time
/usr/bin/time
/usr/share/doc/time-1.7
/usr/share/doc/time-1.7/COPYING
/usr/share/doc/time-1.7/NEWS
/usr/share/doc/time-1.7/README
/usr/share/info/time.info.gz
On at least one RH system, with rpm v4.8.0, yum v3.2.29, and repoquery v0.0.11, `repoquery -l rpm` prints nothing.
If you are having this issue, try adding the `--installed` flag: `repoquery --installed -l rpm`.
`DNF` Update:
To use `dnf` instead of `yum-utils`, use the following command:
$ dnf repoquery -l time
/usr/bin/time
/usr/share/doc/time-1.7
/usr/share/doc/time-1.7/COPYING
/usr/share/doc/time-1.7/NEWS
/usr/share/doc/time-1.7/README
/usr/share/info/time.info.gz
Problem
I know how to use rpm to list the contents of a package (`rpm -qpil package.rpm`). However, this requires knowing the location of the .rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to achieve this?