Working with RPM packages on Linux means choosing an operation for an installed package record or a package file. The rpm command queries and manages individual RPM packages.
This article shows how to inspect installed packages and local RPM files, then choose an installation method when dependencies need resolving.
TL;DR
The rpm command queries and manages individual RPM packages. Use DNF or YUM when you want repositories to resolve dependencies.
- Use rpm -q name for an installed package and rpm -qp file.rpm for a local file.
- Use rpm -qi for details, rpm -ql for installed files, and rpm -V to compare installed files with package metadata.
What Is the RPM Command?
RPM is both a package format and a package manager used by Fedora, RHEL, CentOS Stream and related systems.
RPM’s query mode can target either an installed record or a package file.
For the installed-package query, provide its exact package name. A successful query identifies the installed record. A package-not-installed response means RPM ran but found no matching record, which differs from the missing-command error shown later.
The RPM manual documents package-information and file-list queries.
How to Use the RPM Command Step by Step
Choose an installed package name or a path to a local RPM file, then select the operation that matches your task.
Step 1: Query an installed package
The -q option looks up a named installed package. Add -a to list all installed records or -i to show package information.
rpm -q bash
rpm -qi bash
rpm -ql bash
The first query prints the installed package label. The next two show metadata and the recorded file list. Replace bash with a package name from your distribution.
Step 2: Inspect a local RPM file
Add -p when the target is an RPM file rather than an installed package, so you can inspect the download before installation.
rpm -qip ./tool-2.1-4.x86_64.rpm
rpm -qpR ./tool-2.1-4.x86_64.rpm
The first command displays package metadata. The second lists declared requirements, which can name capabilities or libraries rather than package names. DNF can consult enabled repositories to find providers for those requirements.
Step 3: Install or upgrade from a file
Use -i for a new installation or -U to install and replace an older version when applicable. Either operation changes installed software, so it requires the system’s normal administrator authorization.
rpm -i ./tool-2.1-4.x86_64.rpm
rpm -U ./tool-2.1-4.x86_64.rpm
dnf install ./tool-2.1-4.x86_64.rpm
On a DNF system, this local-file form lets the package manager resolve available dependencies and present a transaction for review.
Step 4: Verify or erase an installed package
Use -V to check an installed package, or -e with its database name to erase it. A downloaded filename is not that name.
rpm -V tool
rpm -e tool
An empty verification report means no checked difference was printed, not that every file or behavior was tested. Before erasing, review the package name and follow the distribution’s normal authorization process.
RPM Command Limits and Common Errors
YUM also supports local RPM installation. Review the proposed transaction for the package name, architecture and dependency changes, since enabled repositories affect which requirements it can satisfy.
I ran rpm -q rpm and got the following shell error with exit status 127.
/usr/bin/bash: line 1: rpm: command not found
Check the distribution’s supported package tools when the executable is missing.

| Symptom | Meaning | Next check |
|---|---|---|
| rpm: command not found | RPM tooling is unavailable in the shell or distribution | Check the distribution’s native package manager and supported tools |
| package name is not installed | The query reached RPM but found no matching installed record | Check the installed package name with the distribution’s package tools |
| Failed dependencies during a local install | Required capabilities have no available provider in the transaction | Use DNF or YUM with enabled repositories, or obtain compatible dependencies |
| RPM filename passed to rpm -q | The query expects an installed package name | Use rpm -qp file.rpm for file metadata |
An RPM can target a different distribution release or CPU architecture despite using the .rpm extension. Check vendor support and package metadata before installation. Avoid --nodeps because it skips dependency checks and can leave software unusable.
For a fuller repository workflow, see the DNF command guide. The Linux package management guide explains how package formats relate to distribution tools, while the RPM file installation guide focuses on local installers.
Conclusion
Choose the operation that matches your package target, then consult the RPM 6.1 manual for the full option set.
FAQ
These answers distinguish the RPM utility from the higher-level installation tools commonly used with it.
What does the rpm command do in Linux?
It queries, verifies, installs, upgrades, and erases individual RPM packages and reads package metadata.
How do I check whether an RPM package is installed?
Run rpm -q package-name with the installed package name, not the downloaded .rpm filename.
Does rpm install dependencies automatically?
RPM can check dependency requirements, but DNF or YUM is generally the right choice for resolving them from configured repositories.
How do I inspect an RPM file before installation?
Use rpm -qip file.rpm for package information and rpm -qpR file.rpm to list its declared requirements.
