There are a number of pkgs that weren't removed with "apt-get purge" and I would like to automate cleaning them up.
You can't apt-get purge apache2.2-common
because the pkg is already removed.
You can still list the files that are in the pkg with dpkg -L apache2.2-common
.
This means I could just remove the list of files in the pkg, but how would dpkg know this? How do I remove the config files left behind AND remove it from the following report?
Example output:
$ dpkg -l | grep ^rc
rc apache2.2-common 2.2.14-5ubuntu8.10 Apache HTTP Server common files
rc libapache2-mod-php5filter 5.3.10-1ubuntu2ppa6~lucid server-side, HTML-embedded scripting languag
rc libapr1 1.3.8-1ubuntu0.3 The Apache Portable Runtime Library
rc libaprutil1 1.3.9+dfsg-3ubuntu0.10.04.1 The Apache Portable Runtime Utility Library
rc libgd2-xpm 2.0.36~rc1~dfsg-3.1ubuntu1 GD Graphics Library version 2
rc libt1-5 5.1.2-3ubuntu0.10.04.2 Type 1 font rasterizer library - runtime
rc php5-gd 5.3.10-1ubuntu2ppa6~lucid GD module for php5
rc ssl-cert 1.0.23ubuntu2 simple debconf wrapper for OpenSSL
Something like this will find the package names:
Or to remove the number of pipes you can use this:
So the next step is to feed one of those lists into
dpkg --purge
. Using a subshell you can do that easily:Simple!