5 Tips for Managing RPMs

Monday Jun 20th 2011 by Joe Brockmeier

Fedora or RHEL users working with RPMs will find these 5 little-known features to be of great value.

Last week, I looked a couple of lesser-known features for working with Debian packages, using dpkg, apt-file and aptitude. This week, I want to look at a few things you can do when working with RPMs if you happen to be on a Fedora or RHEL-derived system.

One thing you may want to do is to see what package owns a file. For this you'll use rpm -qf filename. For example, if you want to know what package owns /usr/lib/libkonq.so.5 then you'd run rpm -qf /usr/lib/libkonq.so.5. On Fedora 15, the command would return kdebase-libs-4.6.3-1.fc15.i686.

Ever been confused about what configuration file or files exist for a package? It's not unusual to install a package (or have a package installed as a default) and not know exactly what configuration files are used to manage it. To determine the configuration files installed with a package, use rpm -qc packagename. Then, to find out what configuration files exist for the gnome-vfs2 package, you'd use rpm -qc gnome-vfs2, which will return:


This tells you the files that go with the package, but what about a specific command? For that, combine the two options (cf) that go with the query command. So, to find out the configuration files that apply to the yum command, you'd use rpm -qcf yum. This will display:


Note that not all commands have a configuration file. If you look for less, for example, you'll get no results.

Wondering if the files installed by a package are still in the same state as they were when installed? The rpm -qs packagename command will display all of the files installed by the package with a notation of "normal," "replaced," "not installed" and so on. This can be useful in a number of situations -- it may help detect an intrusion, or you can use this when you're working on a client's system and need to troubleshoot a problem. (This is also good for those clients that claim they've touched nothing, when you're pretty sure they were tinkering before the system blew up.)

Finally, if you need to find a package that provides a dependency (like a library) use yum resolvedep dependency like so: yum resolvedep libz.so.1, which (on Fedora 15) will return 0:zlib-1.2.5-3.fc15.i686.

If you're on SUSE or openSUSE, don't fret -- I'll cover some tips and tricks for Zypper soon.

Joe 'Zonker' Brockmeier is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks, Linux.com, CIO.com, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at jzb@zonker.net and follow him on Twitter.

Follow ServerWatch on Twitter

Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved