HowTo: RPM List Files

To list the files contained in an RPM package, you can use the rpm command with the -ql option. Here’s how to do it:

  1. Open a terminal and run the following command to list the files contained in an RPM package:
rpm -ql package-name

Replace package-name with the name of the RPM package that you want to list the files for.

For example, to list the files contained in the httpd RPM package, run the following command:

rpm -ql httpd

This will display a list of all files contained in the httpd RPM package.

  1. If the RPM package is not installed on your system, you can use the rpm2cpio command to extract the files from the package and then use the cpio command to list the files. For example, to list the files contained in the httpd-2.4.6-97.el7.x86_64.rpm file, run the following commands:
rpm2cpio httpd-2.4.6-97.el7.x86_64.rpm | cpio -idmv --quiet
find . -type f

The first command extracts the files from the RPM package and pipes the output to the cpio command, which extracts the files from the archive. The second command uses the find command to list all regular files in the current directory and its subdirectories.

This will display a list of all files contained in the RPM package, including their paths.

Note that you may need to install the rpm2cpio command and the cpio command if they are not already installed on your system.

Leave a Comment