Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I was doing a package removal with apt-get remove but then realized I should have done a --purge along with it to remove the configuration files.

Can I remove the packages configuration files easily or do I need to reinstall the package and then remove with a --purge?

share|improve this question
up vote 28 down vote accepted

Yes you can.

From the command line:

sudo apt-get remove --purge packagename

This will remove all of the remaining files that the package installed.


You can also do this from a GUI:

  • Install Synaptic Install Synaptic from the Software Center
  • Run Synaptic
  • Find packages listed under "Not Installed (residual config)"
    Packages with residual configs
  • Right click the package and click, mark for complete removal Menu
  • Click the check button on the tool bar and click apply when the dialogue pops up. Dialogue
share|improve this answer
2  
Under apt 1.0.9.2ubuntu2 apt-get remove --purge hasn't removed configuration files or databases if issued after the package was removed, indicating that Package xxxx is not installed, so not removed. dpkg --purge was needed for correct cleanup. – h7r Feb 18 '15 at 19:09

Here is a command that will meet your request.

dpkg --purge `dpkg --get-selections | grep deinstall | cut -f1`
share|improve this answer

Yes!

Whilst waiting for more in depth technical answer as I don't have a clue about the internals of Ubuntu!

Tested this on apache2.2-common and mediawiki.

Performing apt-get remove left some files, trying to perform the command again resulted in an error saying that the package was not installed, however, it was available on tab completion for apt-get remove.

When I did apt-get remove apache2.2-common --purge, this both removed the left over files and removed it from the tab completion.

Again, can only give the answer and not a technical "why", but, I look forward to reading someone else's answer!

share|improve this answer

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.