Sunday, September 19, 2010

Clean up Ubuntu to increase free disk space

1:16 AM |

Windows has built-in tools to clean up stale and unnecessary files, and there is also CCleaner to clean up files (also see CCleaner Enhancer).

However, Ubuntu does not have any easily accessible tools for increasing available drive space. I learnt it the hard way when I had only 500 MB disk space on my Wubi install (Ubuntu installed as an app in Windows). After following the steps mentioned below, it increased to 1.4 GB. Granted, it was an experimental install to test out Ubuntu and write a few tutorials (like this one!) on any issues I would encounter.

But here are several methods to clean up your Ubuntu install partition and improve available disk space.

1. Search for and install Bleachbit in Synaptic (System > Administration). It combines several important files and folder cleanup – including system cache and unused system files, packages and languages, browser files etc.
2. Clean up Aptitude install files cache. All files that are downloaded with apt-get are stored there even after the download. To do the clean up, enter the line below in a Terminal (Applications > Accessories).

sudo aptitude clean


To automate cleaning up files after install, go to System > Administration > Synaptic Package Manager > Settings > Preferences > Files > Delete downloaded packages after installation.

Note that the downside to this cleanup is that you will have to redownload files if you need to reinstall any of those programs.

3. Residual Config files are packages left behind after packages are uninstalled. To remove them, navigate to System > Administration > Synaptic Package Manager.

Click Status, then “Residual config”. If you have any packages listed there, mark them for complete removal and hit Apply. If Residual config is not shown, then you do not have any packages to remove, so see the next step.
4. Remove partially downloaded packages that were not removed.
sudo apt-get autoclean

Delete unused locale data with localepurge. Search for it on Synaptic and install. It removes unneeded locale files and localized man pages. The cleanup will be executed upon completion of install. When selecting languages, check to keep only those you use – for me, it would be English (en).
5. Remove orphaned packages with deborphan. Search and install from Synaptic. It finds packages that are not depended upon by other apps. Once installation of deborphan is complete, open Terminal and execute the following code:

sudo deborphan | xargs sudo apt-get -y remove --purge

You will need to enter your account password when asked (tip for beginners: the cursor does not move even when you type, ignore it, type and hit enter). A bunch of files will be deleted and its details will be listed on Terminal.

If you have any other tips of your own, please share them in comments below. I will update this article (with attribution to you, of course).

Leave A Comment