Thursday, May 6, 2021

Extract files from RPM package without installing

An RPM package is a file consisting of a cpio archive that contains the files to be installed and a header that contains metadata information about the package.
You can use the simple utility tool rpm2cpio to convert the contents of an RPM package into a cpio archive and then use the cpio command to extract the contents of that archive without needing to install the RPM package.

rpm2cpio name_of_rpm_package.rpm | cpio -idmv

Note that this will extract the files to the current folder.
Here is an explanation of the options used for the cpio command:

  • i: extract files
  • d: create leading directories where needed
  • m: preserve previous file modification times for the extracted files
  • v: verbose

No comments:


Related Posts Plugin for WordPress, Blogger...