Created 2015-08. Xubuntu 14.04.2.

WARNING!

I am NOT a system administrator. I am a home user who can reinstall my operating system as many times as I want. If you are a professional and you follow these steps, then you are an idiot and I cannot help you. If you only want the steps I took, scroll down to the "Procedure" heading.

Summary

I will list the steps I took to reduce the amount of disk space used by the Xubuntu operating system. This is mostly likely applicable to Ubuntu and Debian. I have a separate 10GB partition for operating system files and a much large /home partition. Obviously, you can download too many audio and video files and fill up with "stuff" in your home folder. This deals only with the operating system folders.

Background

I still have not found a simple, graphical tool to show the amount of disk spaced used as you browse the system. After over a decade of daily linux use, I'm a little embarassed to say I have Windows Explorer envy! Gnome has a program called Disk Usage Analyzer that sounds very promising, right? When you start it up, however, you get the pic below... This is not a user-friendly GUI by any stretch of the imagination.

Disk Usage Analyzer

I have learned a couple of useful command line tools for quickly getting an overview of disk usage, but these are not things I think about running on a regular basis. The command "df -h" will show total, used, and free disk space of a system when no path is specified. This made it clear that the partition was filling up, but still no details. I ended up opening my file browser to "/" and righ-clicking each folder and looking at the properties.

df command results

Procedure - The BIG THREE Culprits

I originally thought that 10GB would be plenty for operating system files... and I'm pretty sure I was right. There were GIGABYTES of old modules, kernels, and packages that were, as far as I can tell, not in use for a while. From a top-level investigation, the biggest users of disk space were /usr=4GB, /lib=2GB, and /var=1GB. This is what I deleted. You can use wildcards with rm if you know how. Otherwise, repeat for each directory you want deleted.

  • Delete all but the latest 3 (do I need more than 1?) linux-headers directories in /usr/src.
  • me@myhost$ cd /usr/src
    me@myhost$ sudo rm -r <linux-headers_#_you_want_gone>

  • Delete all but the latest 3 linux kernel modules directories in /lib/modules.
  • me@myhost$ cd /lib/modules
    me@myhost$ sudo rm -r <#_linux_kernel_modules_you_want_gone>

  • For fast internet connections, delete packages used by apt (/var/cache/apt/archives). This means you'll have to download them each time.
  • me@myhost$ sudo apt-get autoclean

These procedures reduced my system disk space usage from 97% to 67%.

Notes

Read the warning above and note that I have a SEPARATE PARTITION for operating system files. You can permanently mess up your system by deleting things in these directories. Last warning.