linux poison RSS
linux poison Email

Extract individual file(s) from rpm package using rpm2cpio

As the name implies, rpm2cpio takes an RPM package file and converts it to a cpio archive. Because it's written to be used primarily as a filter, there's not much to be specified. rpm2cpio takes only only one argument.

The optional argument is the name of the package file to be converted. If there is no file-name specified on the command line, rpm2cpio will simply read from standard input and convert that to a cpio archive.

We can even convert any rpm package into cpio archive using following command:
rpm2cpio  amarok-1.4.10-26.1.i586.rpm > blah.cpio
Here we've directed rpm2cpio to convert the logrotate package file into cpio archive - blah.cpio.

Extracting one or more files from a rpm package file:
rpm2cpio /root/amarok-1.4.10-26.1.i586.rpm |cpio -ivd ./usr/share/doc/packages/amarok/README
above command will extract README file into current working directory under ./usr/share/doc/packages/amarok/ folder

In this case, the cpio options -i, -v, and -d direct cpio to:
  * Extract one or more files from an archive.
  * Display the names of any files processed, along with the size of the archive file, in 512-byte blocks.
  * Create any directories that precede the file name specified in the cpio command.


Post a Comment

Related Posts with Thumbnails