Last updated on August 5, 2020 by Dan Nanni
foo.rpm) from somewhere, and I would like to manually extract files from the RPM package. Is there an easy way to extract files from an RPM package without installing it?
An RPM package contains a set of files, typically compiled software binaries, libraries, and their development source files. These files are packaged in a
cpio archive format, and finally wrapped in an RPM file along with any necessary package-specific metadata.
You can view the content of an RPM package with
If you want to extract files from an RPM package without installing it, here is how: first obtain a
cpio archive from the RPM file, and then extract actual files from the
The following describes how to achieve this from the Linux command line.
First, install necessary command line tools.
$ sudo apt-get install rpm2cpio
$ sudo yum install rpm
Once the necessary tools are installed, proceed as follows. This will extract all files in
foo.rpm into the current directory.
$ rpm2cpio foo.rpm | cpio -idmv
rpm2cpio command extracts a cpio archive from an RPM file, and
cpio command extract files from the cpio archive.
The options used with the
cpio command are described as follows.
-i: extract files
-d: make directories
-m: preserve modification time
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean