3 Ways to Maintain a Clean, Lean Ubuntu Machine

Article by Josef Nankivell (4,324 pts ) , published Jul 10, 2009

Once in a while, you may want to do some maintenance on your Ubuntu machine and clean up unnecessary files that are chunking up large storage space in your hard disk. Here are 3 ways that you can use to clean up your Ubuntu.

Analyse your disk usage

The first thing you need to do is find out which files are consuming the largest bulk of storage space in your hard disk. Go to Applications->Accessories->Disk Usage Analyzer and click Scan Filesystem to analyze your disk usage pattern. You will be able to see instantly which files/folders are taking up the bulk.

Once you have determined the files that are taking up large amounts of storage space, you can do the following:

  • Decide if you have any use for the files. If not, send them to the trash.
  • If you have no immediate use of the file, but will need to reference it in the future, either backup to a CD/DVD or to an external hard disk. If the file is too big, you may want to compress and split it to several small files for easier storage.

Clear duplicate files

Over the time, you accumulate a dozen copies of the same file lying in different corners of your system. The best thing is to hunt them down, and eliminate them before they take control of the world! Hrm, maybe I exaggerated there, however, we still want to get rid of them.

FSlint is a utility to find and clean various forms of lint on a filesystem, especially duplicate files and broken symlinks.

Install fslint, or via the terminal:

sudo apt-get install fslint

Go to Applications > System Tools > FSlint. Add the file path that you want to search. On the left, click the Duplicate tab and click Find at the bottom.

Other than finding duplicate files, FSlint can also find broken symlinks, empty directories, bad IDs and even redundant temp files, all of which you can delete and recover your precious disk space.

Clean up your package installation

If you have installed and uninstalled a lot of applications, chances are your system has a lot of dependency files you have absolutely no use for. Here are some useful commands to get rid of any partial package and remove any unused dependencies:

Cleaning up of partial package:

sudo apt-get autoclean

Cleaning up of the apt cache:

sudo apt-get clean

Cleaning up of any unused dependencies:

sudo apt-get autoremove

A good practice to avoid any left behind is to use the autoremove command whenever you want to uninstall an application.

sudo apt-get autoremove application-name