Let’s say you need to free up some space on Ubuntu — how do you go about it?
Unlike Windows, with its built-in defrag and disk clean-up tools, Ubuntu doesn’t make it immediately obvious how you go about trying to free up space.
What do you do once you’ve emptied the trash, and deleted those .ISO downloads? How do you recover more space?
We’re going to 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 stale KBs.
Whenever you need more space — and heck, even if you don’t — here are 5 simple ways to free up disk space on Ubuntu.
1. Clean the APT Cache (And Do It Regularly)
It sounds so obvious, and yet chances are you haven’t done this.
By default Ubuntu keeps every update it downloads and installs in a cache on your disk, just in case you ever need it again.
This is useful if you regularly add and remove apps, find yourself needing to reconfigure/reinstall a specific package, or simply have a poor connection.
But the flip side is that the apt package cache can quickly swell to several hundred MBs. This command tells you how big your apt cache is:
du -sh /var/cache/apt/archives
To clean the apt cache on Ubuntu simply run the following 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)
Now, admittedly, this step is one you want to approach with caution.
Having a choice of kernels to boot up is, honestly, quite handy, especially if you notice something has gone awry while using the latest one.
Unless you’re in the throes of constant hardware woes there’s little need to hoard kernels.
It’s easy to remove old kernels in Ubuntu. You can do it from the command line using the following command:
sudo apt-get autoremove --purge
Note that this command will only remove kernels that a) are no longer needed and b) were installed from the Ubuntu archive through system updates. If you install kernels manually or through a third-party PPA you’ll need to get your hands dirty.
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 nosiness, or to handle a particular task.
Whatever the excuse, if an app is no longer needed, but more space is, don’t be afraid to uninstall it.
Typical apps you may wish to expunge include web browsers (are you ever going to use Opera, Epiphany, Midori and Min?), music players (heck knows there’s enough of ’em) and games that sounded good in the Steam Store description but ended up being as much fun as a Windows 10 update combo.
And everyone has LibreOffce Draw knocking about doing nothing!
Don’t lie to yourself about might-needs, and could-dos. The beauty of most software is that it’s not going anywhere anytime soon. This is never truer than on Linux, where most apps are just an apt install command away.
To remove a specific app by name run:
sudo apt-get remove package-name1 package-name2
To remove 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
Writing a list on system cleaning could easily end up 10x as long as this one if we were to tell you about every app, cache, log and system process hiding in every nook and cranny.
BleachBit saves us from doing that. It’s like the CCleaner of Linux – a byte scouring beast. The app can remove pretty much everything and anything and should only ever be used with caution.
It can wipe the caches of more than 70 popular desktop applications (including most web browsers); hoovers up old file, browser and bash history; and makes light work of logs you’ll never read.
No surprise that we recommend installing it as one of our things to do after installing Ubuntu.
You can install BleachBit on Ubuntu 16.04 LTS straight from Ubuntu Software. Run it as root, and check the boxes besides the parts you’d like to clean. Click ‘Preview’ to get an estimate of how much space they take up, and click “Clean” to remove them.
5. Stay up to date (seriously, do it!)
The most obvious step on this list is also the one few people would think to recommend. Unlike Windows, where every new update adds more overhead, package updates on Linux regularly free space rather than use it.
So next time you put off that 56MB librandom-package102 update fearing you’ll lose space, maybe think again!
That just about covers it. If you only remember two steps from this list make it the first and last.
- Clean your apt cache from time-to-time
- Install patches, updates, and fixes
Now go and free some space!
Let us know how much you manage to claw back (as well as share your own top space-saving tips) in the comments! To see more articles like this from Scott, share the love by sharing his article on social media.