10.2.6. Querying

10.2.6. Querying

The RPM database stores information about all RPM packages installed in your system. It is stored in the directory /var/lib/rpm/, and is used to query what packages are installed, what versions each package is, and any changes to any files in the package since installation, among others.

To query this database, use the -q option. The rpm -q package name command displays the package name, version, and release number of the installed package package name. For example, using rpm -q foo to query installed package foo might generate the following output:

foo-2.0-1

You can also use the following Package Selection Options with -q to further refine or qualify your query:

There are a number of ways to specify what information to display about queried packages. The following options are used to select the type of information for which you are searching. These are called Information Query Options.

For options that display lists of files, add -v to the command to display the lists in a familiar ls -l format.


Note: This documentation is provided {and copyrighted} by Red Hat®, Inc. and is released via the Open Publication License. The copyright holder has added the further requirement that Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. The CentOS project redistributes these original works (in their unmodified form) as a reference for CentOS-5 because CentOS-5 is built from publicly available, open source SRPMS. The documentation is unmodified to be compliant with upstream distribution policy. Neither CentOS-5 nor the CentOS Project are in any way affiliated with or sponsored by Red Hat®, Inc.