Keep Ubuntu Clean and Fast - Maintenance guide

Reasons

I'm always exploring new applications, I do system updates everyday and so on, so the system begins to accumulate a given amount of garbage over time. This happens with Ubuntu as well as with every other Linux distro or OS really. But the cleaning process you must take so the system is always running optimal differs greatly, so I'll focus this article on Ubuntu which is currently the Desktop Distro I use on a daily basis.

How to keep Ubuntu cleaner

Install  localepurge

Localepurge is a Linux tool that automatically recovers disk space wasted for unneeded locale files and localized man pages.

To install and setup under Ubuntu simply issue the following in your terminal app:

$sudo apt-get install localepurge 

During the install of localepurge you'll get a setup window on your terminal displaying the locales you want to choose from, say that like me you want both English and European Portuguese, it would be something like this:

en en_GB en_GB.UTF-8 en_US en_US.UTF-8 pt pt_PT pt_PT.UTF8 

LocalePurge will execute automatically every time you install new packages from here on, either via the terminal or using Ubuntu Store or other UI package managers. If you have an habit of installing from the terminal you'll get stats on the end of the installation from the localepurge execution like this:

Processing triggers for menu ... localepurge: Disk space freed in /usr/share/locale: 24804 KiB localepurge: Disk space freed in /usr/share/man: 0 KiB localepurge: Disk space freed in /usr/share/gnome/help: 0 KiB localepurge: Disk space freed in /usr/share/omf: 0 KiB localepurge: Disk space freed in /usr/share/doc/kde/HTML: 0 KiB Total disk space freed by localepurge: 24804 KiB

You can also still call localepurge manually at any given time using:

$sudo localepurge 

although since it runs automatically after each time apt-get install runs, it is pointless to run it manually most of the times. Just install it and let it work for you ;)

Use Ubuntu-Tweak

is an amazing all-in-all tool for Ubuntu. In a nutshell it let's you easily configure settings that otherwise would require you to edit some config file on your device, therefore easily exposing this configurations in a nice UI.

Besides allowing for the configuration of a number of settings, it also has a section dedicated to System Cleanup which is the one I'll focus here.

Let's start with installing Ubuntu-Tweak via the terminal (or if you don't want to add the PPA to your System just download the .deb package from ):

sudo add-apt-repository ppa:tualatrix/ppa ; sudo apt-get update ; sudo apt-get install ubuntu-tweak

After you've installed it simply start the application. It's called ubuntu-tweak in the terminal, but it will also have an icon on your Desktop Environment applications menu.
Once the application starts, open the top menu called Janitor. On the left you'll have a list of all the things the Ubuntu-Tweak Janitor can scan and therefore clean from your system.

Ubuntu Tweak Janitor Ubuntu-Tweak's Janitor

Ubuntu-Tweaks let's you easily clean the following items:

  • APT Cache
  • Browser's Cache
  • Old Kernels
  • Thumbnails Cache
  • Residual Configuration files

Notice that, as expected, most of this things could be cleaned with terminal commands like apt-get  autoclean , but some like Application's specific cache you would have to clean those files by hand so in all Ubuntu-Tweak Janitor has a good bunch of cleaning items that will save you a lot of time :)

Use BleachBit

is another great tool focused specially on keeping the system clean. BleachBit is in no way a Ubuntu-specific tool so if you use any other Linux distro you can benefit from it as well ;).

To install BleachBit simply type the following on your terminal application:

$sudo apt-get install bleachbit 

See the picture below to get a sense of the garbage items BleachBit cleans from  your system:

Bleach bit BleachBit

BleachBit can be run as root or as a normal user, given of course that if you run it as root it can scan and clean further kinds of items as opposed that if you run it as your user, it'll only have access to your user's files. Like Ubuntu-Tweak it let's you preview the data to be cleansed before proceeding to deletion, for those you want to double-check if everything seems OK.

If you're wondering if it is worth using both Ubuntu-Tweak Janitor and BleachBit? I would answer Yes, because although they do clean some of the same items such as APT Cache, they also clean different things individually. And also BleachBit's Localizations cleansing is different from localepurge, so all in all those 3 tools complement each-other rather well.

BleachBit

Pedro Veloso

Software Developer with focus on Android Development. Likes to explore other technical solutions and always eager to experiment with new technologies :). Website