If you install and uninstall a lot of packages using apt, aptitude, or dpkg, you may find that you end up with a lot of redundant packages, or ones which have been uninstalled but the config files are left behind.
You can find packages which have been removed but still have config files by running (basically the status field will be ‘rc’):
dpkg -l | grep “^rc”
Or, suppose you installed mysql 5.1 from my previous post using the dotdeb repositories and wanted to see a list of what was installed:
dpkg -l | grep dotdeb
Now, removing those packages is easy, all you need to do is pass the list to dpkg –purge using awk in a similar way to grep above, so the 2 examples above would become:
dpkg --purge `dpkg -l | awk '/^rc/{print $2}'` dpkg --purge `dpkg -l | awk '/dotdeb/{print $2}'`(note that you may need to delete and retype the backticks depending on how cut and paste is handled)
Using the methods above, it should be easy to clean up your system.







