Advanced RPM Package Querying

RPM provides many ways to query packages and the RPM database. This is very helpful when troubleshooting packages and your Linux system.

Extracting the Contents of an rpm (rpm2cpio)

Sometimes it is useful to extract the contents of an RPM package without installing it. This is especially useful if you want to examine particular files before installing them or if you need to recover a configuration file. The tool rpm2cpio allows you to do this. To extract all files from an rpm, go to a temporary directory and enter

$ rpm2cpio rpmfile.rpm | cpio -ivd

This will extract all files from the package. If you want only particular files, you can use wildcards as follows:

$ rpm2cpio rpmfile.rpm | cpio -ivd 'etc*'

Finding ...

Get Special Edition Using Linux®, Sixth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.