How to View Files in an RPM Package on Linux
Posted on Thu 25 December 2025 in Systems
On RPM-based Linux systems (like Red Hat, CentOS, Fedora, openSUSE), it is common to interact with packages in .rpm format. Often, we need to know what files a package contains before installing it, or which package is responsible for a specific file already installed on the system. For this, the rpm tool offers several useful options.
1. List Files of an RPM Package Without Installing¶
If you have a downloaded .rpm file and want to see what files it will install (and where) without installing it, you can use the -qlp option:
rpm -qlp package_name.rpm
-q: Query mode.-l: List files.-p: Query a package file instead of an installed one.
Example:
rpm -qlp nginx-1.20.1-1.el8.x86_64.rpm
2. Find the Owner Package of an Installed File¶
If you find a file on your system and want to know which RPM package it belongs to (useful for debugging or knowing if you can safely delete it), use the -qf option:
rpm -qf /path/to/file
Example:
rpm -qf /etc/nginx/nginx.conf
# Expected output: nginx-1.20.1-1.el8.x86_64
3. Get Detailed Information about a Package¶
To see complete information about a package (version, description, dependencies, etc.), whether installed or an .rpm file, you can use -qi (for installed packages) or -qip (for package files):
rpm -qi installed_package_name
# Example: rpm -qi nginx
rpm -qip package_name.rpm
# Example: rpm -qip nginx-1.20.1-1.el8.x86_64.rpm
Conclusion¶
Mastering these simple options of the rpm command gives you much greater control over packages and files on your Linux system, facilitating administration and debugging. They are essential tools for any system administrator or developer working with RPM-based distributions.
Original article: Cómo Ver los Archivos de un Paquete RPM o Deb