Extract individual files from an RPM

To extract an individual file from an rpm package without installing the rpm:

  1. Use rpm2cpio or rpm -qpl to list files and full paths in the package:
    $ rpm2cpio <package_name> | cpio -t

  2. Use rpm2cpio to extract a file. Run this command from /tmp or elsewhere in order to avoid overwriting any current system files.
    This creates the full path in the current directory and extracts the file specified.
    $ rpm2cpio <package_name> | cpio -iv --make-directories <full-file-path>

  3. To extract everything to the current directory:
    $ rpm2cpio <package_name> | cpio -ivd
Comment