yum Command: List The Contents (Files) Of A Package

Posted on in Categories last updated November 17, 2012

The rpm -qi command list the files of a package. How do I use yum command to list the contents of a package under CentOS or RHEL installed on IBM server hardware?

You can not use yum command for rpm queries. You need to use repoquery command for querying information from yum repositories similarly to rpm queries. This command will work with installed packages as well packages currently not installed on the system.

repoquery command RHEL / CentOS / Fedora Linux installation

Type the following yum command to install yum-utils package:
# yum -y install yum-utils
Sample outputs:

Loaded plugins: product-id, protectbase, rhnplugin, security, subscription-
              : manager
Updating certificate-based repositories.
Unable to read consumer identity
0 packages excluded due to repository protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.30-14.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
 Package        Arch        Version             Repository                 Size
 yum-utils      noarch      1.1.30-14.el6       rhel-x86_64-server-6      101 k
Transaction Summary
Install       1 Package(s)
Total download size: 101 k
Installed size: 0  
Downloading Packages:
yum-utils-1.1.30-14.el6.noarch.rpm                       | 101 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : yum-utils-1.1.30-14.el6.noarch                               1/1 
Installed products updated.
  Verifying  : yum-utils-1.1.30-14.el6.noarch                               1/1 
  yum-utils.noarch 0:1.1.30-14.el6                                              


The syntax is:

repoquery -q -l {package-name-here}
repoquery -q -l --plugins {package-name-here}
repoquery -q -l --plugins *{package-name-here}*


To list the contents of a package called htop using yum, run:

repoquery -q -l --plugins htop

Sample outputs:


To list and match all php packages, enter:

repoquery -q -l --plugins php*

OR (warning may take a long time)

repoquery -q -l --plugins php* | less

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

2 comment

  1. Hey, thanks a lot for this! But say, I don’t think the -q option is necessary, given this description for it in repoquery’s man page:

    -q, –query
    For rpmquery compatibility, doesn’t do anything.

Leave a Comment