Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I have been uninstalling applications as well as removing or purging their configuration files using the command apt-get --purge remove {package_name}.

I have come across several posts on the net including Ubuntu's guide at https://help.ubuntu.com/community/AptGet/Howto that reads "This command completely removes a package and the associated configuration files. Configuration files residing in ~ are not usually affected by this command" when just using the command apt-get purge {package_name}.

Is there a difference in running the command apt-get --purge remove {package_name} and apt-get purge {package_name}? Why would you use one over the other?

share|improve this question
up vote 22 down vote accepted

The command apt-get --purge remove has been around since APT was added to Debian and it used to be the only way to completely purge a package with apt. The command apt-get purge was finally added in the last few years, the old option was not removed, and there is still lots of documentation showing the older syntax. They do exactly the same thing.

I often still use the longer command apt-get --purge remove simply because I have used it more often, and forget that the shorter version is now available.

One other useful thing to keep in mind is that the --purge option can be used with the apt-get autoremove, and there is not equivalent apt-get autopurge. So if you use the apt-get autoremove option to remove automatically installed packages you will have lots of old crufty configs from those packages, since you just removed them.

share|improve this answer
1  
You can purge data from removed packages using dpkg -l | grep '^rc' | awk '{print $2}' | xargs dpkg --purge (command from help.ubuntu.com/community/AptGet/Howto) – etam1024 Jan 8 at 21:41
    
@etam1024 sure, and there are other ways too. The above just mentions a method to do it in a single operation with autoremove. – Zoredache Jan 8 at 21:50
    
I don't think you understood. As you wrote autoremove removes packages, but "you will have lots of old crufty configs from those packages, since you just removed them". The command I pasted deletes those files. So the commands apt-get autoremove and the one pasted together in this order behave like autopurge. – etam1024 Jan 9 at 18:05

Your Answer

 
discard

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.