Background
You have added a few apps from the debian repo and no longer need then - actually you’ve already uninstalled them but you forgot to --purge
when you apt-get remove
the app. This post provides a quick script to cleanup any app (package) that has remnant config data residing after a remove
of an app.
As you remove packages (apt-get remove xxx) in debian the configuration files for the package are not automatically removed (note: you can use the --purge
flag to remove config files with the removal of the app). Over time this can add up and/or you may want to remove the configs to force a clean install.
Details
A very useful script to cleanup (purge) package remnants (e.g. config files associated with packages):
|
|
note: the script will prompt you on what it will purge prior to the purge
Breakdown of the script:
dpkg --get-selections | grep deinstall | cut -f1
: this grabs a list of all packages that are marked as ‘deinstall’ indpkg
and passing this list toapt-get purge
which will remove them.
Notes
If you would like to verify or view more things you can always dump the results of the dpkg command to a file, verify the file, then read the file in to apt-get purge.
|
|
I’ve also ran across the need to manually review all installed packages and remove unneeded items. You can quickly do that with the following:
|
|
Now open the review.lst
file in your favorite text editor and mark each row you
want to remove (I typically change INSTALL to UNINSTALL); for example, if I wanted to uninstall zip
I would use:
|
|
Next, I can simply grep through the file on uninstall to remove all packages that I’ve marked as uninstall:
|
|