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) Section 5.2.1.1
-p <file>(or "-") Query package file <file> (URLs OK) Section 5.2.1.4
-f <file> Query package owning <file> Section 5.2.1.3
-a Query all installed packages Section 5.2.1.2
--whatprovides <x> Query packages providing capability <x> Section 5.2.1.6
-g <group> Query packages belonging to group <group> Section 5.2.1.5
--whatrequires <x> Query packages requiring capability <x> Section 5.2.1.7
Information Selection Options Page
<null> Display full package label Section 5.2.1.1
-i Display summary package information Section 5.2.2.1
-l Display list of files in package Section 5.2.2.2
-c Display list of configuration files Section 5.2.2.3
-d Display list of documentation files Section 5.2.2.4
-s Display list of files in package, with state Section 5.2.2.5
--scripts Display install, uninstall, verify scripts Section 5.2.2.9
--queryformat (or --qf) Display queried data in custom format Section 5.2.2.10
--dump Display all verifiable information for each file Section 5.2.2.8
--provides Display capabilities package provides Section 5.2.2.6
--requires (or -R) Display capabilities package requires Section 5.2.2.7
General Options Page
-v Display additional information Section 5.2.2.2.1
-vv Display debugging information Section 5.2.3
--root <path> Set alternate root to <path> Section 5.2.4
--rcfile <rcfile> Set alternate rpmrc file to <rcfile> Section 5.2.5
--dbpath <path> Use <path> to find the RPM database Section 5.2.6

5.1. 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.