Extract file contents of rpm archive

This post demonstrates how to extract the file contents of an rpm package, for e.g. analyzing the rpm packaging.

We need two commands for that:

  • rpm2cpio - Extract cpio archive from RPM Package Manager (RPM) package.
  • cpio - copy files to and from archives

To extract in current directory

rpm2cpio appl-1.0.0.noarch.rpm | cpio -idmv

cpio options explained:

  • -i extract
  • -d make-directories
  • -m preserve-modification-time
  • -v verbose :-)