Direct dpkg ↔ rpm Command Equivalents

Chapter 7
rpm Deep Dive
Querying, verifying, and manual package operations — the RPM-world counterpart to Chapter 4's dpkg deep dive

Just as dpkg sits beneath apt, rpm sits beneath dnf — the low-level engine for direct package inspection and manual operations. This chapter mirrors Chapter 4's structure closely, since the underlying concepts are genuinely the same.

Direct dpkg ↔ rpm Command Equivalents

dpkg command (Chapter 4)rpm equivalentPurpose
dpkg -lrpm -qaList all installed packages
dpkg -s <pkg>rpm -qi <pkg>Detailed status/info of one package
dpkg -L <pkg>rpm -ql <pkg>List files a package owns
dpkg -S <file>rpm -qf <file>Which package owns a given file
dpkg -i <file>.debrpm -i <file>.rpmInstall a standalone package file directly
dpkg -c <file>.debrpm -qlp <file>.rpmList a package's contents without installing it

Querying — In Practice

$ # List every installed package
$ rpm -qa

$ # Check if a specific package is installed
$ rpm -q nginx
nginx-1.22.1-9.fc39.x86_64

$ # Full detailed information
$ rpm -qi nginx
Name : nginx
Version : 1.22.1
License : BSD

Verifying Package Integrity

Beyond install-time GPG signature checks (Chapter 6), rpm can verify whether currently-installed files still match what the package originally provided — genuinely useful for detecting accidental or malicious modification after the fact.

$ rpm -V nginx
S.5....T. c /etc/nginx/nginx.conf

Each character flags a specific kind of discrepancy — S means file size differs, 5 means the checksum doesn't match, T means the modification time changed. A clean, unmodified package produces no output at all from this command.

rpm -V is a genuine, lightweight integrity-check tool
Running this against a critical package (especially one like openssh-server or sudo) periodically, or specifically after suspecting tampering, gives a quick signal of whether anything's been modified outside the normal package-management process — a config file legitimately edited by hand will show up here too, which is expected, not necessarily alarming.

Working with Standalone .rpm Files

$ # Install a standalone .rpm — like dpkg, no dependency resolution of its own
$ sudo rpm -i some-package.rpm

$ # dnf's equivalent handles a local file WITH dependency resolution — generally preferred
$ sudo dnf install ./some-package.rpm
The same dpkg-vs-apt relationship applies identically here — prefer dnf install over raw rpm -i for local files
Exactly Chapter 4's lesson, restated: rpm -i has no awareness of repositories or dependencies, identical to plain dpkg -i's limitation. dnf install ./file.rpm (note the leading ./, which tells dnf this is a local file path rather than a repository package name) gets the dependency resolution benefit while still installing a file you've downloaded directly.

Removing and Upgrading Directly with rpm

$ sudo rpm -e nginx # erase/remove — equivalent to dpkg --remove
$ sudo rpm -U some-package.rpm # upgrade to a newer version from a local file

Chapter 7 Quick Reference

  • rpm -qa ↔ dpkg -l; rpm -qi ↔ dpkg -s; rpm -ql ↔ dpkg -L; rpm -qf ↔ dpkg -S
  • rpm -V — verifies installed files still match what the package originally provided; flags size/checksum/time discrepancies
  • rpm -i — installs a standalone file directly, with the same no-dependency-resolution limitation as dpkg -i
  • dnf install ./file.rpm — preferred over raw rpm -i; gets dependency resolution for a local file
  • rpm -e — remove; rpm -U — upgrade from a local file
  • Same underlying relationship as dpkg/apt — rpm is the low-level engine, dnf is the dependency-aware front end
  • Next chapter: checking dependencies & troubleshooting broken packages across both families