Use rpm2cpio to Extract Files from RPM Packages on CentOS7

I had needs to confirm certain files or directories are installed from which packages, this is the way to do it and solve my problem. To extract the files from rpm packages, we need to download it first, please refer here: Download rpm packages from repository on CentOS7

Once you have th rpm file, use this command to extract files from rpm package to your local hdd.

rpm2cpio myrpmfile.rpm | cpio -idm


Now you have all the files from the packages! You can use -idmv to show the extracting process if you want to.