Table 5-1. rpm -q Command Syntax
|rpm -q (or --query) options|
|Package Selection Options||Page|
|pkg1 … pkgN||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|
|-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|
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:
You're poking around your system, and you come across a file that you just can't identify. Where did it come from?
Your friend sends you a package file, and you have no idea what the package does, what it installs, or where it originally came from.
You know that you installed XFree86 a couple months ago, but you don't know what version, and you can't find any documentation on it.
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.