There is no direct RPM option available via rpm command to extract an RPM file. But there is a small nifty utility available called rpm2cpio. It Extract cpio archive from RPM Package Manager (RPM) package. With the following hack you will be able to extract an RPM file.
So rpm2cpio converts the .rpm file specified as a single argument to a cpio archive on standard out. If a – argument is given, an rpm stream is read from standard in.
rpm2cpio filename.rpm | cpio -idmv
Output of rpm2cpio piped to cpio command (see how to use cpio) with following options:
- i: Restore archive
- d: Create leading directories where needed
- m: Retain previous file modification times when creating files
- v: Verbose i.e. display progress