I installed Ubuntu Linux on an old PC and it’s working great, but I keep running out of disk space. What’s my best move to try and slow down the disk usage creep I’m experiencing? Running the latest LTS version of Ubuntu, if that matters.
Like any operating system, Linux has a tendency to do useful things for the user that are sometimes at odds with the efficient running of the system itself. A common scenario is a system that will crank up the CPU to deliver more power – particularly for games – even though that has a corresponding deleterious effect on the battery life: Faster = less.
File version history is another area that is impacted by this, though for most users it’s invisible since modern disk drives are so darn big. If you have hundreds of gigabytes of free space and are editing papers for a college course throughout the semester, the extra disk space required is but a drop in the proverbial bucket. However, Ubuntu also has a bad habit of keeping the historical versions of all edited files forever, which means that over time it might well get unwieldy. Fortunately, there are some system settings to tame this File History beast, along with automatically removing temporary files. Let’s check it out…
UBUNTU LINUX SETTINGS
Launch Ubuntu, log in, then go to Settings. This is most easily accessed from the menu on the top right of the screen if you’re running a stock GNOME setup. You’ve probably already poked around in Settings so this should look familiar:
I tend to fiddle with the appearance of my own Ubuntu system, so that’s my default category. What we want is “Privacy” from the left column of options. That reveals…
If you’re on “Connectivity”, click on “File History & Trash” to get here. Now you can see that Ubuntu by default keeps historical copies of files you edit forever. Not great. Instead, you might want to set it to a specific duration.
HOW LONG TO KEEP FILE HISTORY
I wish there were longer options, but, as you can see, here are your choices:
Setting it to one day seems a bit risky, but 30 days is reasonable and gives you enough time to take off for a 2-week Spring Break adventure, get back, recover, then find out something’s happened to your file and you need to get a recovery copy!
If you don’t want to set a specific duration, set a reminder in your calendar to occasionally “Clear History…” (though it’s not clear whether that will clear all historical copies, even those just a few hours old, or honor the duration you specify).
I recommend 30 days coupled with an occasional off-computer backup of your most critical files. If you’re working on a dissertation or critical report, maybe email drafts to yourself occasionally as a cheap and easy redundant backup tactic.
EMPTY TRASH & DELETE TEMP FILES
While we’re on this Settings window, scroll down because there are two more settings that can affect the efficient use of your disk space over time: “Trash & Temporary Files“:
Without this enabled, your trash will accumulate every file you add, whether it’s a 35K data file or an enormous 2.9G movie. Over time it’s sure to be a problem. What’s interesting is that temporary files are managed separately – typically in /tmp or /usr/tmp – and can also just sit and sit, eating up disk space years after you’ve installed an update or run an app that crashes.
In this instance, there are a lot more options for how long these files should be saved before they are removed:
Unless you have a space crisis, I recommend no faster than 14 days for this particular automated task. Certainly, 1 hour is crazy fast and makes me anxious just thinking about it!
Finally, you can empty the trash immediately with “Empty Trash…”
And, similarly, you can also delete all those temp files with “Delete Temporary Files…”
Between them, these should help you clean up some of the junk on your Linux box and keep it clean into the future. Good luck!
Pro User Tip: I’ve been writing about Linux since the dawn of the operating system, and Unix before that. Please check out my extensive Linux help area for lots of additional tutorial content while you’re visiting. Thanks!