gnome shell trash panel item
Let’s go beyond the obvious

Let’s say you need to free up space on Ubuntu — how do you go about doing it?

Unlike Windows, which comes with built-in defrag and disk clean-up tools, Ubuntu doesn’t make it immediately obvious how you go about freeing up space.

Once you’ve emptied the trash and deleted those sizeable .ISO downloads, then what? How do you recover more space?

Below, I show you 5 super simple (and in some cases blindingly obvious if easily forgotten) steps you can take to get back those GBs, materialise more MBs, and clean out the KB cruft!

Next time you need more space, or even if you don’t, be sure to follow these 5 simply ways to free up disk space on Ubuntu.

1. Clean the APT Cache (And Do It Regularly)

It sounds obvious yet chances are you haven’t done this for a while.

By default Ubuntu keeps every update it downloads and installs in a cache on your disk, just in case you need it again.

If you regularly add and remove apps, find yourself needing to reconfigure/reinstall a specific package, or simply have a poor connection, this cache will prove useful.

But if you don’t, he apt package cache can quickly swell to several hundred MBs. To find out how big your your apt cache is, run:

du -sh /var/cache/apt/archives

Clean the apt cache on Ubuntu using the command:

sudo apt-get clean

The apt clean command removes ALL packages kept in the apt cache, regardless of age or need. If you’re on a slow, capped or intermittent connection you may want to consider skipping this step.

2. Remove Old Kernels (If No Longer Required)

remove old kernels

This step is one you should approach with caution.

Having a choice of kernels to boot from is handy, especially if you notice something goes awry when using a newer one.

But unless you’re in the throes of endless hardware woes there’s no real need to hoard kernels.

To remove old kernels in Ubuntu run the following command:

sudo apt-get autoremove --purge

This this command only remove kernels that a) are no longer needed and b) were installed from the Ubuntu archive through system updates. If you have installed a newer Linux kernel manually through a third-party PPA you’ll need need to roll up your sleeves and remove those by hand.

3. Uninstall Apps/Games You Never Use (And Be Honest!)

Chances are you have a number of apps installed that you never use. Maybe you installed them on the back of an awesome review, out of curiosity, or to tackle a task you’ve since completed.

Whatever your excuse, if you no longer need an app, it’s taking up space, so don’t be afraid to uninstall it.

Typical apps you may wish to expunge include web browsers (will you ever use Opera, Midori, et al?), music players (heck knows there’s enough of ’em), and games that sounded good in the Steam Store blurb but proved to be less fun than a Windows 10 combo update!

Plus, everyone has LibreOffce Draw sat there never being used! 😅

Don’t lie to yourself about might-needs or could-dos, either. The beauty of most software is that it’s not going away anytime soon. This is never truer than on Linux, where apps remain but an apt install command away.

You can uninstall apps from the from the command line on Ubuntu like so:

sudo apt-get remove package-name1 package-name2

To purge excess packages and dependencies that are no longer required (because you’ve uninstalled other packages or newer versions have replaced them) run the following command:

sudo apt-get autoremove

4. Use A System Cleaner like BleachBit

Screen Shot 2016-08-09 at 16.09.32

Writing a “to-do” list on system cleaning would end up 10x longer if we listed every app, cache, log and system process hiding in every nook and cranny of your OS.

BleachBit saves us from doing that.

It’s sort of like CCleaner for Linux (if you can remember that): a byte scouring beast. The app scans for and cleans out as much cruft, fluff, and caches as it can find – so should be used with caution.

BleachBut is able to clean the caches of over 70 popular desktop applications (including Firefox and Google Chrome), hoover up old file and bash histories, and make short work of those crash logs you will never get around to reading.

No surprise that we recommend this app often in our lists of things to do after installing Ubuntu.

You can install BleachBit on Ubuntu 16.04 LTS (and above) straight from Ubuntu Software. Search for it by name or run sudo apt install bleachbit.

Run BleachBit as root for maximum cleaning power (you’ll see an icon for this in the application launcher). Then, check the boxes next to the things to clean, hit Preview for an estimate of how much space they take up, then click Clean to get ’em gone.

5. Stay up to date (seriously, do it!)

The most obvious step on this list is also the one few people think of. See, unlike Windows, where every new update adds more overhead and bloat, package updates on Linux often free space rather than demand more.

So, next time you put off that 156MB librandom-package102 update because you’re running low on space, perhaps think again!

Summary

That just about covers it. If you only remember two steps from this list make it the first and last.

  1. Clean your apt cache from time-to-time
  2. Install patches, updates, and fixes

Now go forth and free space!

Let us know how much space you manage to claw back or share your own top space-saving tips in the comments!