How to maintain a “clean” Ubuntu
Ubuntu is (unfortunately) the most popular GNU/Linux distribution (I still prefer Fedora), as it has been the easiest to use for many years now, making it an obvious choice for every newcomer. As most new users don’t know if and how they are supposed to maintain they distribution, and since Ubuntu doesn’t offer any tools for this job by default, I will provide an overview on the matter through this quick guide.
Avoid compilation from source (or at least make it the clean way)
If compiling from source is not something that you absolutely need, you should avoid it for the sake of a clutter-free system. While source compilation brings many benefits to the user, it also requires the maintaining of the tarball in the case that you need to uninstall the software in the future, and it can result in the installation of multiple versions of the same software in your system. If you have to compile from source, use “checkinstall” instead of “make install” which will generate a .deb file that is easier to handle (uninstall, check version conflicts, etc.).
Also you should be never (as far as possible) install software compiled from source directly under /usr but install under /usr/local and for a so much more easily managed setup, use the “stow” method so that locally installed files for each software item stay together under a single directory and thus can easily be removed after unstowing by deletion of that directory.
Learn how to use stow from articles at
Use “maintenance” commands
Updating your system through the default updating tool will gradually cause the accumulation of packages and the filling of the cache. This can have a larger impact when you’re uninstalling software packages and their dependencies are left behind for no reason. Use the following commands once in a while to ensure that you don’t keep things that are not needed in your system:
sudo apt-get clean
This will flush the local cache from the retrieved package files.
sudo apt-get autoclean
This will clear out only the absolutely not necessary packages that cannot be found in the repositories anymore, or a newer version of them is located.
sudo apt-get autoremove
This command will remove packages that were installed as dependencies for another package that has been removed, and so are no longer needed.
Localepurge is a utility that can potentially save you significant disk space in the long run. It basically removed all localization of the installed packages except for the selected system language. You may install it by “ sudo apt-get install localepurge ” and it will automatically run each time you update or install something. The only drawback is that localepurge will require some extra time to do the job.
Use the “ucaresystem” utility
ucaresystem is a software utility for those who care about their Ubuntu system. It basically automates the process of giving maintenance commands one by one, as it is a complete update and cleaning tool. Install ucaresystem by adding the corresponding ppa by running the following commands on a terminal:
sudo add-apt-repository ppa:utappia/stable sudo apt update sudo apt install ucaresystem-core
and then run it with:
ucaresystem will update the package lists, update the system libraries, install available updates, remove unneened packages, remove older versions of the Linux kernel, remove unused config files, and finally clean out the downloaded packages. One thing to note is the ucaresystem keeps the active Linux kernel and the next former version as backup. I have tested this utility in Ubuntu derivatives like Elementary OS Freya and it works without a problem.
While ucaresystem includes the “deborphan” command, you may also use GtkOrphan to gain more control over what gets to stay in the system and what’s thrown out of the window. It is simple to use and straight forward as it scans for orphaned packages upon launch. The options can be found on the bottom, while an insightful tab containing the non-orphaned packages and their dependencies shown in a convenient tree view mode is also available. Install it with:
sudo apt-get install gtkorphan
Do you want to go deeper and clean out caches and unused data from your applications as well? BleachBit can help you do just that while also providing an all-around system cleanup capability. BleachBit allows users to remove junk files like history, cache, temporary files, logs, crash reports, etc. Just select the boxes that correspond to a maintenance action and click on the red button located on the top left to remove the files.
Clicking on the magnifier first will allow you to get an overview of what’s to be removed and how much disk space will be freed after the completion of all operations.
Be careful about what you select, as sometimes the storage space gained is asymmetrically beneficial to the time required for the re-setting of application preferences, re-filling of the cache with data that saves you time on a daily basis, etc.
Use Ubuntu Tweak
Ubuntu Tweak’s “Janitor” is another very useful maintenance tool. Displaying the storage gains and the package names directly provides enough insight to allow the user to act with enough confidence and safety. Just tick the boxes that correspond to the removal of an item and then press the “clean” button located on the lower right. You won’t find Ubuntu Tweak on your distribution’s default repositories, so you’ll have to download the .deb package from the website.