Debian/Ubuntu cleanup

Springtime, that means cleaning out that lazy-maintained, often-upgraded dusty Debian/Ubuntu install, right? The following commands proved to be very handy in getting rid of stuff you most likely don’t need anymore, and you basicly won’t have to lift a finger.

I’m pretty sure this only removes packages you don’t need, but if you’re worried, you can do an apt-get simulation by adding -s to the command line, and you can check the list of packages deborphan thinks are useless by just executing sudo deborphan.

GUI-driven version of these tools are called computer-janitor, gtkorphan and, more generally synaptic package manager.

# Install required stuff
sudo apt-get install deborphan
# Cleaning packages which are not needed anymore and partial packages
sudo apt-get --purge autoremove
sudo apt-get autoclean
# Cleaning orphaned libraries
sudo deborphan | xargs sudo apt-get -y remove --purge
# Cleaning unneeded translations
sudo apt-get install localepurge
# Select which languages you want to keep, then:
sudo localepurge