How to list all files contained in a RPM package

Suppose you want to install a particular RPM package on Fedora or CentOS, but want to check the content of the package before installing it. This situation may arise when you try to install any missing binary or library file in your system.

In this tutorial, I will describe how to list all files contained in a RPM package on CentOS, Fedora or RHEL.

Method One

There is a command-line tool called repoquery which can query information of YUM repositories. This tool allows you to view the content of a RPM package without installing the package.

To install repoquery on CentOS, Fedora or RHEL:

$ sudo yum install yum-utils

To check a list of files contained in a particular package (e.g., tcpdump) using repoquery:

$ repoquery -l tcpdump

Method Two

The second method to view all the files inside a package without installing it is via rpm command. In this case, however, you need to download a RPM package locally in order to query the package with rpm command.

You can download a RPM package with yum command. Since you do not want to install it, you must use "--downloadonly" option.

To download a particular RPM package without installing it, you need to install a Yum plugin for adding "--downloadonly" command option as follows.

$ sudo yum install yum-plugin-downloadonly

Now you can use yum command to download a RPM package as follows.

$ sudo yum reinstall tcpdump -y --downloadonly --downloaddir=/tmp

With "reinstall" option, the above command will download a requested RPM package, even when the package is currently installed on your system. The downloaded package will be stored in /tmp directory as requested.

To list files of a downloaded RPM package, run the following command.

$ rpm -qpl /tmp/tcpdump-4.3.0-2.fc18.x86_64.rpm

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

Leave a comment

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