Previous Section  < Day Day Up >  Next Section

Recipe 2.5. Collecting Information on Installed RPMs

2.5.1 Problem

You want to know what packages are installed on your system, what files belong to a package, or what package a file belongs to. There are lots of reasons for wanting this information; you might want to know exactly what version of some program is on your system, or you may be asking, "what does this thingy belong to?" You might even change some file accidentally, and want to know what you've broken.

2.5.2 Solution

Use RPM's querying features. All queries start with rpm -q.

To query the RPM database to see if a program is already installed, use:

$ rpm -q tuxpaint


To do a case-insensitive search for an installed RPM, using a partial package name, use:

$ rpm -qa | grep -i kde





To list files in an installed package, use:

$ rpm -ql kdegames





To list the documentation for an application, use:

$ rpm -qd kdegames | grep katomic




To list the configuration files for a package, use:

$ rpm -qc openssh


To list the configuration files for a command, use:

$ rpm -qcf /usr/bin/ssh


To list all installed packages, use:

$ rpm -qa





To save the list to a file, while viewing the output on the screen, use:

$ rpm -qa | tee rpmlist.txt

To see what package a file belongs to, use:

$ rpm -qf /usr/bin/tuxkart


RPM queries will not follow symlinks, and will report that the file is "not owned by any package." To find the file that a symlink points to, use:

$ namei ~/tuxkart

f: tuxkart

 l tuxkart -> /usr/games/tuxkart

   d /

   d usr

   d games

   - tuxkart

To display package information, use:

$ rpm -qi kdegames

Name        :kdegames       Relocations/usr

Version     :3.1.4             Vendor:Red Hat, Inc.

Release     :2              Build date: Mon 13 Oct 2003

Install date:Tue Nov 5 2003 Build

Group       : Amusements/Games   Source RPM:kdegames-3.1.4-2.src.rpm

Size        :16167441       License: GPL

Signature   :DSA/SHA1, Tue 28 Oct 2003 Key ID b446d04f2a6fd2

Packager    :Red Hat, Inc.


Summary     :K Desktop Environment - Games

Description :

Games and gaming libraries for the K Desktop Environment

Included with this package are: kenolaba, kasteroids, kblackbox, kmhajongg, kmines, 

konquest, kpat, kpoker, kreversi, ksame, kshisen, ksokoban, ksmiletris, ksnake, ksirtet, 

katomic, kjumpingcube, ktuberling

2.5.3 Discussion

Another way to find documentation for a particular application is with the finddoc script in Recipe 1.11.

2.5.4 See Also

    Previous Section  < Day Day Up >  Next Section