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

See all Redhat/CentOS/Fedora Core related FAQ
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 or dnf 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.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux terminal
Category Package Manager
Prerequisites yum or dnf command
OS compatibility AlmaLinux Fedora Linux RHEL Rocky Stream
Est. reading time 3 minutes

Replace the yum command with dnf when using Fedora Linux or RHEL/CentOS 8 or above.

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 when using the yum command:
    repoquery --list bash
    repoquery -l '*bash*'
  3. The dnf users, need to run the following command to see list the contents (files) of a package named htop:
    dnf repoquery -l htop

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
# For dnf users #
# dnf -y install dnf-utils

Sample outputs:

Updating Subscription Management repositories.
Last metadata expiration check: 0:03:30 ago on Thursday 31 March 2022 12:05:22 PM EDT.
Dependencies resolved.
 Package     Arch     Version            Repository                       Size
 yum-utils   noarch   4.0.21-4.el8_5     rhel-8-for-x86_64-baseos-rpms    73 k
Transaction Summary
Install  1 Package
Total download size: 73 k
Installed size: 23 k
Downloading Packages:
yum-utils-4.0.21-4.el8_5.noarch.rpm            275 kB/s |  73 kB     00:00    
Total                                          273 kB/s |  73 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                       1/1 
  Installing       : yum-utils-4.0.21-4.el8_5.noarch                       1/1 
  Running scriptlet: yum-utils-4.0.21-4.el8_5.noarch                       1/1 
  Verifying        : yum-utils-4.0.21-4.el8_5.noarch                       1/1 
Installed products updated.


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:
How to list the contents of a package using yum command on Linux
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.

Summing up

You learned various commands list the contents of a package using the yum command on a CentOS/RHEL and clones. Display yum commands and options help using the help command or man command:

man yum
man dnf
yum help

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

4 comments… add one
  • Leslie Satenstein Dec 16, 2012 @ 16:51

    Your emails with wonderful reminders or tutorials of explanation, are much appreciated.
    I have your emails archived with thunderbird and my gmail account.

  • Spencer Williams Jun 25, 2014 @ 15:14

    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.

  • Luna Schneider Apr 7, 2021 @ 12:35

    These commands worked on my CentOS 8 server at AWS. Thank you for puttying it together.

  • Ben Duncan Mar 30, 2022 @ 19:44

    Excellent – Exactly what I was looking for ..

Leave a Reply

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

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.