My little article Cleaning up a Debian GNU/Linux was published at Debian Administration where lot’s of people replied with other ways to achieve the same goals. It was very nice to see all the different approaches with all the different pros and cons.
In the end I ended up changing my own approach for one that is faster and cleaner so I wanted to share it with you. Still, go to the Debian Administration version of the article and read the comments, they are very cool (thanks to all those who posted!).
Here’s the approach: I mark all the packages as automatically installed:
aptitude --schedule-only markauto ~i
This doesn’t really mark them; if it did, it would also remove them (try dropping the “–schedule-only” and you’ll see what I am talking about).
Then I run aptitude in graphical mode, that is, by:
there I press “g” to perform the actions… what actions ? the previously scheduled ones. It’ll mark every single package as automatically installed so it’ll show you a long list of packages to remove (all of them ? it’d be interested to let it run and see where it dies). I read the list, one by one, pressing “+” on each one I want to mantain installed. Automatically the dependencies will be marked as not-to-delete (although they’ll remain in auto mode). Once you finish you press “g” again and that’s it, it’ll remove all the un-needed packages.
To remove the configurations of those packages no longer needed (you have made backups first… no, it’s not a question) I run:
aptitude purge ~c
I also mentioned Ubuntu because this works for Ubuntu as well (actually, the last times I’ve used it was on Ubuntu installations). It will also work in other members of the Ubuntu family, like Kubuntu, Edubuntu and Xubuntu as well as other Debian derivate like Mepis.