Querying the RPM Database

You can query RPM’s database, which lists the packages installed on your system. For example, to display a simple description of an installed package, use a command like this one:

            rpm -q 
            package

In this command, package is the name of the package you want RPM to describe. In response, RPM prints the package name, version, and release number.

Rather than use the -q option and the package name, you can use any of the following alternative options:

-a

Causes RPM to display information about all installed packages

-f file

Causes RPM to display information about the package that owns file

-p packagefile

Causes RPM to display information about the package contained in packagefile

You can also tailor the output of an RPM query, by specifying one or more of the following options:

-c

Causes RPM to display a list of configuration files included in the package

-d

Causes RPM to display a list of documentation files included in the package

-i

Causes RPM to display the package name, description, release number, size, build date, installation date, vendor, and other information

-l

Causes RPM to display the list of files that the package owns

-s

Causes RPM to display the state of all the files in the package—normal, not installed, or replaced

For example, the command:

            rpm -qid rhide

displays information about the rhide package, including a list of documentation files included in the package.

Get Learning Red Hat Enterprise Linux & Fedora, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.