Can I automatically purge every package I've ever uninstalled?
As an Ubuntu noob, I install and uninstall a lot of packages, to try them out. However, for months, I made the mistake of using apt-get remove
instead of apt-get purge
, which I didn't even realize exists.
Is there a way to cause apt-get
to purge every package I've uninstalled? My system is full of leftover files I neither want or need from dozens of different packages.
A simpler alternative, using aptitude
(not installed by default)
sudo aptitude purge '~c'
~c
is an aptitude search pattern, it means 'Select packages that were removed but not purged'. (The single quotes are to prevent the possible expansion of ~c
by the shell as the home directory of a user c
.)
Note that purging will remove system configuration files, usually located in /etc
, but personal configuration files, usually in some hidden directory in your home, are not removed (it is not always simple to know which they are).
https://help.ubuntu.com/community/AptGet/Howto says:
dpkg -l | grep '^rc' | awk '{print $2}' | xargs dpkg --purge
those two will clean your packages, but you should get in the habit of using this,
sudo apt-get remove --purge <package name>
that will purge the packages.
also check this out, this an utility called ubuntu-tweak, it has a feature that is called janitor, that lets you see the packages to clean, and even the configs. http://www.howtogeek.com/112974/how-to-customize-ubuntu-with-ubuntu-tweak/