Quiz Entry - updated: 2026.07.14
What is the rpm -q family for, and what can it tell you about an installed package?
rpm -q ("query") asks the local RPM database about installed software — whether a package is present, which files it owns, its config/docs, and where a given file came from.
Because RPM tracks every installed file, you can interrogate that database to answer "what's on this system and where did it come from?" The query is always rpm -q plus a letter:
| Command | Answers |
|---|---|
rpm -qa |
List all installed packages |
rpm -q NAME |
Is this package installed (and which version)? |
rpm -qf /path/file |
Which package owns this file? |
rpm -qi NAME |
Show package info (summary, license, size) |
rpm -ql NAME |
List every file the package installed |
rpm -qc NAME |
List its configuration files |
rpm -qd NAME |
List its documentation files |
rpm -q --scripts NAME |
Show its install/uninstall scriptlets |
rpm -qf /usr/bin/ls # → coreutils (which package put ls here?)
rpm -ql openssh-server # every file sshd installed
To inspect a .rpm file that isn't installed yet, add p (for "package file"): rpm -qlp pkg.rpm, rpm -qip pkg.rpm.
Why rpm -qf is a daily lifesaver: when a stray file confuses you, rpm -qf instantly names the package responsible — invaluable for debugging and for knowing what to reinstall or remove.
Go deeper:
rpm(8) man page — query mode (
-q) and its sub-options (-qa,-qf,-ql,-qi).