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

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

You can not use yum command for rpm queries. You need to use the 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 Linux based system.

How to list the contents of a package using yum command

The procedure to list the files installed by a yum package:

  1. Open the terminal bash shell and type:
    sudo yum install yum-utils
  2. See the files installed by a yum package named bash:
    repoquery --list bash
    repoquery -l '*bash*'

Let us see installation and usage in details.


First you need to install yum-utils package. It is a collection of utilities and examples for the yum package manager. It includes utilities by different authors that make yum easier and more powerful to use. 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 -l {package-name-here}
repoquery -q -l {package-name-here}
repoquery -q -l --plugins {package-name-here}
repoquery -q -l --plugins *{package-name-here}*


  • -l : List files in package
  • -q : For rpmquery compatibility (not needed)
  • --plugins : Enable plug-ins support


To list the contents of a package called htop using yum, run:
repoquery -q -l --plugins htop
Sample outputs:

Equivalent rpm command syntax:
# rpm -ql {packageName}
# rpm -ql htop
# rpm -qlp /path/to/nginx.rpm

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

A note about Fedora Linux users and dnf command

Fedora latest comes with dnf command. So the syntax is as follows:
# dnf repoquery -l {packageName}
# dnf repoquery -l htop

How to show general information about package

Pass the -i option to the repoquery command:
# repoquery -i {packageNamehere}
# repoquery -i nginx

Sample outputs:

Name        : nginx
Version     : 1.13.8
Release     : 1.el7_4.ngx
Architecture: x86_64
Size        : 2665830
Packager    : None
Group       : System Environment/Daemons
URL         : http://nginx.org/
Repository  : nginx
Summary     : High performance web server
Source      : nginx-1.13.8-1.el7_4.ngx.src.rpm
Description :
nginx [engine x] is an HTTP and reverse proxy server, as well as
a mail proxy server.

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts