Chapter 5. Getting Information About Packages

Table 5-1. rpm -q Command Syntax

rpm -q (or --query) options
Package Selection Options Page
pkg1pkgN Query installed package(s) the section called The Package Label
-p <file>(or "-") Query package file <file> (URLs OK) the section called -p <file> — Query a Specific RPM Package File
-f <file> Query package owning <file> the section called -f <file> — Query the Package Owning <file>
-a Query all installed packages the section called -a — Query All Installed Packages
--whatprovides <x> Query packages providing capability <x> the section called --whatprovides <x>: Query the Packages That Provide Capability <x>
-g <group> Query packages belonging to group <group> the section called -g <group>: Query Packages Belonging To Group <group>
--whatrequires <x> Query packages requiring capability <x> the section called --whatrequires <x>: Query the Packages That Require Capability <x>
Information Selection Options Page
<null> Display full package label the section called The Package Label
-i Display summary package information the section called -i — Display Package Information
-l Display list of files in package the section called -l — Display the Package's File List
-c Display list of configuration files the section called -c — Display the Package's List of Configuration Files
-d Display list of documentation files the section called -d — Display a List of the Package's Documentation
-s Display list of files in package, with state the section called -s — Display the State of Each File in the Package
--scripts Display install, uninstall, verify scripts the section called --scripts — Show Scripts Associated With a Package
--queryformat (or --qf) Display queried data in custom format the section called --queryformat — Construct a Custom Query Response
--dump Display all verifiable information for each file the section called --dump: Display All Verifiable Information for Each File
--provides Display capabilities package provides the section called --provides: Display Capabilities Provided by the Package
--requires (or -R) Display capabilities package requires the section called --requires: Display Capabilities Required by the Package
General Options Page
-v Display additional information the section called -v — Display Additional Information
-vv Display debugging information the section called Getting a lot more information with -vv
--root <path> Set alternate root to <path> the section called --root <path>: Use <path> As An Alternate Root
--rcfile <rcfile> Set alternate rpmrc file to <rcfile> the section called --rcfile <rcfile>: Use <rcfile> As An Alternate rpmrc File
--dbpath <path> Use <path> to find the RPM database the section called --dbpath <path>: Use <path> To Find RPM Database

rpm -q — What does it do?

One of the nice things about using RPM is that the packages you manage don't end up going into some kind of black hole. Nothing would be worse than to install, upgrade, and erase several different packages and not have a clue as to what's on your system. In fact, RPM's query function can help you get out of sticky situations like:

The list could go on, but you get the idea. The rpm -q command is what you need. If you're the kind of person that doesn't like to have more options than you know what to do with, rpm -q might look imposing. But fear not. Once you have a handle on the basic structure of an RPM query, it'll be a piece of cake.