Can I purge configuration files after I've removed the package?

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?


Solution 1:

Here is a simple command that will meet your request:

dpkg --purge $(dpkg --get-selections | grep deinstall | cut -f1)

Solution 2:

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