Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list the contents of a package using YUM?

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?

like image 885
Lorin Hochstein Avatar asked Sep 19 '08 17:09

Lorin Hochstein


People also ask

How do I list files in a package?

You can use the repoquery command which is part of the yum-utils to list files installed on a CentOS/RHEL system from a given package. Important: In Fedora 22+ version, the repoquery command is integrated with dnf package manager for RPM based distribution to list files installed from a package as shown above.

How do I list a repository package?

If you want to list all the packages in a repository on your desktop, you can use Synaptic Package Manager. Synaptic is a graphical package management application for APT (APT being the main command line package manager for Debian and its derivatives).


2 Answers

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 
like image 181
Thomas Vander Stichele Avatar answered Sep 28 '22 17:09

Thomas Vander Stichele


rpm -ql [packageName] 

Example

# rpm -ql php-fpm  /etc/php-fpm.conf /etc/php-fpm.d /etc/php-fpm.d/www.conf /etc/sysconfig/php-fpm ... /run/php-fpm /usr/lib/systemd/system/php-fpm.service /usr/sbin/php-fpm /usr/share/doc/php-fpm-5.6.0 /usr/share/man/man8/php-fpm.8.gz ... /var/lib/php/sessions /var/log/php-fpm 

No need to install yum-utils, or to know the location of the rpm file.

like image 43
Levite Avatar answered Sep 28 '22 18:09

Levite