Linux Commands

RPM List Files That are in a Package

Several files are contained within the package, presumably within the Linux file system. It helps you easily find essential package files, such as documentation configuration files.

An RPM file is a Red Hat Package Manager file. RPM is a package manager developed by Red Hat primarily for RedHat-based Linux operating systems such as RHEL, CentOS, Fedora, etc. Developed based on Linux Standard Base (LSB), the open-source RPM is used to manage, install, uninstall software packages in Linux systems. Every RPM package that contains a collection or bundle of files uses the .rpm extension.

Documentation files AUTHOR, TODO, README, etc.
Configuration files Logrotate.conf, updatedb.conf, sshd.conf, etc.
Binary files(executables) Sshd, ssh, xattr, stat, nmap, and so on.

Now, we will cover different options for listing files on a Linux system under a certain package or group.

You can easily locate all the files installed from the RPM package by checking the RPM package manifest in your system. You can also see all the files and locations for a particular RPM package through this method.

rpm -qlp <filename>.rpm

Or

rpm -qilp <filename>.rpm

The following is the output of the RPM command in the above example:

  • -q is for specifying that the command is used for the query
  • -l for listing the files in the package
  • -p for giving the query the uninstalled package file.

Listing in RHEL/CentOS Linux-based Systems

You can list the files that are part of yum-utils installed on the RHEL/CentOS system from any downloaded or given package using the repoquery command. You can install and use yum-utils using the following command.

yum update
yum install yum-utils

Once you have installed yum-utils, you can easily list the RPM package files by running the following command (We have used Firefox for the example):

repoquery --installed -l firefox

Listing in Fedora Based Linux Systems

In Using dnf, the repoquery command can show files installed from packages in Fedora 22+.

dnf repoquery --installed -l firefox

Alternatively, you can list the files installed in the system or inside the .rpm package using the following RPM command. Here, -I or -g means to list the files in the package implicitly:

rpm -ql firefox

Listing in Ubuntu/Debian Based-Linux Systems

You can use the dpkg command on an Ubuntu/Debian distribution with the -L flag to list its derivatives or files installed in Debian systems from any .deb package.

dpkg -L <web server>

Listing RPM Files Before Installing the Package

With the -p option, we can list .rpm package files before installation. Suppose you download any telnet-server RPM package from any online source. Then you can see through the following commands what is present in the downloaded package, which will be installed in the file system or can be done.

rpm -qlp telnet-server-1.2-137.1.i586.rpm

Conclusion

This article taught us how to find or list all the files installed from a ‌package or group of RPM packages in Linux. Different distributions of Linux list these packages using different methods and commands. If you want to know any information related to this article, please tell us by commenting in the comment box.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.