Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Debian, there's at least two ways to delete a package:

  • apt-get remove pkgname
  • apt-get purge pkgname

The first preserves system-wide config files (i.e. those found in "/etc"), while the second doesn't.

What is Fedora's equivalent of the second form, purge? Or maybe I should rather ask if yum remove pkgname actually preserves config files.

share|improve this question
up vote 13 down vote accepted

yum remove is not guaranteed to preserve configuration files.

As stated in the yum HOWTO:

In any event, the command syntax for package removal is:

# yum remove package1 [package2 package3...]

As noted above, it removes package1 and all packages in the dependency tree that depend on package1, possibly irreversibly as far as configuration data is concerned.


As James points out, you can use the rpm -e command to erase a package but save backup copies of any configuration files that have changed.

For more information, see Using RPM to Erase Packages. In particular:

It checks to see if any of the package's config files have been modified. If so, it saves copies of them.

share|improve this answer
That's not really true, "rpm -e" will remove the configuration files if they haven't changed. If they have been changed they are moved to <filename>.rpmsave and not deleted. – James Antill Mar 4 '11 at 20:18

I found this answer to a duplicate question on ServerFault titled: yum equivalent of “apt-get purge" that provides the only method I've seen that can do what apt-get purge <pkg> does on Ubuntu/Debian.

for package in package1 package2 package3
  echo "removing config files for $package"
  for file in $(rpm -q --configfiles $package)
    echo "  removing $file"
    rm -f $file
  rpm -e $package

The only other method I can conceive of here is to parse the output from yum remove <pkg> and then manually delete any files that may have been modified. For example when I recently installed ElasticSearch's RPM for 2.3 I modified several files that were associated with this RPM. When I removed it with YUM you'll get messages in the output like this:

warning: /etc/sysconfig/elasticsearch saved as /etc/sysconfig/elasticsearch.rpmsave
warning: /etc/elasticsearch/logging.yml saved as /etc/elasticsearch/logging.yml.rpmsave
warning: /etc/elasticsearch/elasticsearch.yml saved as /etc/elasticsearch/elasticsearch.yml.rpmsave

These can be deleted post removal using YUM either scripted or by hand.


share|improve this answer
This might be an interesting dnf plugin.... – mattdm Jun 29 at 19:01
@mattdm - this issue has come up from time to time, would be nice if we could do this in the "RPM" world. – slm Jun 29 at 19:23

There is no equivalent for "purge", just use yum remove package.

Also you can use yum reinstall package, when you want to reinstall some package...

share|improve this answer
Actually, as explained in Justin Ethier's answer, yum remove is equivalent to apt-get purge. – Gilles Feb 25 '11 at 20:08
@Gilles Justin Ethier says yum remove is "not guaranteed to preserve configuration files." That's not the same as saying that it is guaranteed not to preserve configuration files (which would mean it is equivalent to apt-get purge). Are you making this (much) stronger claim? – Eliah Kagan Aug 30 '12 at 2:15
@EliahKagan That's the way I understand the yum howto that Justin cites. I'm not sure that it's right, the CentOS seems to be saying the opposite. – Gilles Aug 30 '12 at 2:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.