How To Extract One File From Rpm Using Yum?

Home » CentOS » How To Extract One File From Rpm Using Yum?
CentOS 10 Comments

I want to get the original version of /etc/clamd.d/amavis.conf from the amavisd-new rpm to get the defaults to submit a bug report. I could not figure out how to do this, so I did a reinstall, but it did not replace this file (whatprovides says it comes from this rpm).

Is there a way to extract just the one file, and better yet, place it elsewhere than its regular destination?


10 thoughts on - How To Extract One File From Rpm Using Yum?

  • No it did not. I am thinking I had the current file open in gedit and MAYBE that had a bearing on the reinstall?

    I will attempt to download just the rpm and try to open it with archive manager.

  • From: Robert Moskowitz

    You could also just have renamed your conf file temporarily, reinstalled, moved the default conf file and renamed back your conf file…


  • OK. I am set for what I needed. I went to the repo via http and downloaded the rpm. I then used archive manager via nautilus to get to the file(s) I needed. Now to write up the bug report. Minor item, but it bugs me…. ;)

  • The command line way of getting 1 file out of a rpm is to rpm2cpio.

    rpm2cpio >

    Now you have a cpio archive which you can use to get files out of.

    -Connie Sieh

  • Or:

    rpm2cpio | cpio -idv

    That will extract all the files to the current directory (create a temporarily directory and cd into it before you start).

  • Actually very old to it. I use to do this stuff 10 years ago and my brain just ain’t what it use to be. Use to do my own builds for a number of apps, but doubt I could do a build now!

  • I know it’s petty, but every time I realize I need to use cpio to do this, it really annoys me. This is the only present day use of cpio I’m aware of.