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?
4 Answers
Here is a simple command that will meet your request:
dpkg --purge $(dpkg --get-selections | grep deinstall | cut -f1) 2 Yes you can.
From the command line:
sudo apt-get remove --purge packagenameThis will remove all of the remaining files that the package installed.
You can also do this from a GUI:
- Install Synaptic
from the Software Center
- Run Synaptic
- Find packages listed under "Not Installed (residual config)"
- Right click the package and click, mark for complete removal
- Click the check button on the tool bar and click apply when the dialogue pops up.
You can purge all previously uninstalled packages with aptitude:
aptitude purge ?config-filesYou can also purge individual packages but then you would also have to purge the dependencies one by one. It is not practical.
1Purge do not remove configuration file atleast in my case it was not able to remove configuration file.
To remove configuration file:
- Get list of all configuration directory.
cd ~/.config ls- Remove the directories containing configuration for packagename
rm -rf packagename 1