Recipe 2.5. Collecting Information on Installed RPMs

 < Day Day Up > 

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 tuxpaint-9.13-1

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

$ rpm -qa | grep -i kde lockdev-1.0.1-1.3 kdebase-3.1.4-6 kdeutils-3.1.4-1 kdegames-3.1.4-4

To list files in an installed package, use:

$ rpm -ql kdegames /usr/bin/atlantik /usr/bin/kasteroids /usr/bin/katomic ...

To list the documentation for an application, use:

$ rpm -qd kdegames | grep katomic /usr/share/doc/HTML/en/katomic/common /usr/share/doc/HTML/en/katomic/index.docbook ...

To list the configuration files for a package, use:

$ rpm -qc openssh /etc/ssh/moduli

To list the configuration files for a command, use:

$ rpm -qcf /usr/bin/ssh /etc/ssh/ssh_config

To list all installed packages, use:

$ rpm -qa setup-2.5.27-1.1 tzdata-2003d-1 bzip2-libs-1.0.2-10 ...

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 tuxkart-0.2.0-3

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 host:daffy.perf.redhat.com 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. <http://bugzilla.redhat.com/bugzilla> 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

  • rpm(8)

  • Recipe 1.11

  • Maximum RPM (http://www.rpm.org/max-rpm/index.html)

  • Chapter 16 of Linux in a Nutshell by Ellen Siever, Stephen Figgins, and Aaron Weber (O'Reilly)

     < Day Day Up > 


    Linux Cookbook
    Linux Cookbook
    ISBN: 0596006403
    EAN: 2147483647
    Year: 2004
    Pages: 434

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net