rpm Command
Intermediate Package Management man(1)RPM Package Manager for .rpm files
👁 9 views
📅 Updated: Mar 15, 2026
SYNTAX
rpm [OPTION]... [PACKAGE]
What Does rpm Do?
rpm (Red Hat Package Manager) is the low-level package tool for RHEL, CentOS, Fedora, SUSE, and other RPM-based distributions. It installs, queries, verifies, and removes .rpm packages.
rpm works directly with .rpm files and does not resolve dependencies automatically (use dnf/yum for that). It is used for manual package installation, querying installed packages, and package verification.
rpm is to dnf/yum what dpkg is to apt — the low-level tool that the higher-level package manager builds upon.
rpm works directly with .rpm files and does not resolve dependencies automatically (use dnf/yum for that). It is used for manual package installation, querying installed packages, and package verification.
rpm is to dnf/yum what dpkg is to apt — the low-level tool that the higher-level package manager builds upon.
Options & Flags
| Option | Description | Example |
|---|---|---|
| -i | Install a package | sudo rpm -ivh package.rpm |
| -U | Upgrade (or install) a package | sudo rpm -Uvh package.rpm |
| -e | Erase (remove) a package | sudo rpm -e package_name |
| -q | Query installed package | rpm -q nginx |
| -qa | Query all installed packages | rpm -qa | grep php |
| -ql | List files in installed package | rpm -ql nginx |
| -qf | Find package owning a file | rpm -qf /usr/bin/nginx |
| -V | Verify package integrity | rpm -V nginx |
Practical Examples
#1 Install RPM
Installs with verbose output and progress bar.
$ sudo rpm -ivh package.rpm#2 Query all packages
Lists all installed packages matching "nginx".
$ rpm -qa | grep nginx
Output:
nginx-1.24.0-1.el8.x86_64
#3 List package files
Shows all files installed by nginx.
$ rpm -ql nginx
Output:
/etc/nginx/nginx.conf\n/usr/sbin/nginx
#4 Find file owner
Shows which package installed the file.
$ rpm -qf /etc/nginx/nginx.conf
Output:
nginx-1.24.0-1.el8.x86_64
#5 Verify package
Checks if package files have been modified.
$ rpm -V nginx#6 Package info
Shows detailed package information.
$ rpm -qi nginxTips & Best Practices
Use -Uvh for install/upgrade: rpm -Uvh works for both new installs and upgrades. Prefer it over -ivh which fails if the package is already installed.
rpm -qf for file ownership: rpm -qf /path/to/file tells you which package installed it — the RPM equivalent of dpkg -S.
No dependency resolution: rpm does not install dependencies. Use dnf install package.rpm to get automatic dependency resolution.
Frequently Asked Questions
How do I install an RPM file?
sudo rpm -Uvh file.rpm. Or better: sudo dnf install file.rpm which resolves dependencies.
How do I find which package owns a file?
rpm -qf /path/to/file shows the package name and version.
What is the difference between rpm and dnf?
rpm manages individual .rpm files without deps. dnf handles dependency resolution from repositories.
Related Commands
More Package Management Commands
Master Linux with Professional eBooks
Curated IT eBooks covering Linux, DevOps, Cloud, and more
Browse Books →