Ubuntu 18.04 has been released and it brings a number of improvements on nearly every possible front. Of course, the big deal is the official migration away from Unity to the slick and highly capable GNOME desktop. Along with that change comes a number of additional new features that users will happily welcome. On that front comes an increase in security and privacy. Considering how important privacy has become, this switch to GNOME couldn’t have come at a better time. Why? Because GNOME offers much more in the way of privacy than did Unity.
One privacy feature found in GNOME is the ability to setup the automatic purging of Trash and Temporary files. At first glance, you might not think think this much of a privacy-centric feature. Consider this: What files are collected in your Trash and what temporary files remain on your computer? And do you regularly reboot your machine to clear the /tmp directory (some distributions only clear /tmp on reboot)? Remember, the /tmp directory houses temporary files from applications. If you’re unsure what /tmp does:
The /tmp directory is a special location where temporary files (which applications require during operation) may be placed. These temporary files can:
- be large, or small
- be used for sharing between users, or be private to users
- be persistent across boots, or very volatile
- be machine-local or shared on the network
The fact that these files hold data about a running process or even a user is key here. This particular bit of information is also important, especially when considering privacy. This is why GNOME (hence, Ubuntu 18.04) includes the ability to easily purge those file. But GNOME goes a bit further than just giving you a button for immediate purging. In more recent iterations of GNOME (which includes the release with Bionic Beaver), you can schedule the automatic purging of both the /tmp directory and Trash.
I’m going to show you how to set this up, so you can rest assured your system isn’t holding onto data it shouldn’t for longer than needed.
A word of caution
When purging the /tmp directory, you are erasing temp files applications might be using. Because GNOME only allows you to configure the time between purges (and not a specific date/time), you run the risk of losing data (should a temp file be deleted while an application using said temp file is open). With this in mind, you’ll want to schedule this carefully.
Also, applications cache temporary files in /tmp in order to work more efficiently. When you purge those files, the applications will have to re-cache. If you’re working with an older system, this could be an issue. However, most modern machines won’t bat an eye at an application having to rebuild their caches.
Configuring the purge
In order to configure the purging of /tmp and Trash, open up Settings. Within the Settings app, click Privacy. In this section, click Purge Trash & Temporary Files. A popup window will appear (Figure A), where you can either immediately purge your files or configure a schedule.
Figure A
For either or both the Trash and Temporary File (/tmp), click the slider to enable. Once you’ve enabled one or both, you can then select the Purge After period which ranges from one hour to 30 days.
Once you’ve done this, here’s what I recommend doing. Do not click the Empty Trash or Purge Temporary Files buttons until a time when it’s safe to do so. Say, for instance, you want those files purged at 11 PM. Wait until 11 PM, close all applications, and then click the Empty Trash and Purge Temporary Files buttons. Once you’ve done that, the Purge After will kick in. If you’ve set the Purge After 1 Day, those files will be deleted approximately at 11 PM the next day.
Let the purge begin
Congratulations, you’ve just set up the purging of your Temporary and Trash files. Hopefully this will keep your machine not only running a tiny bit smoother while preventing those temp files from taking up precious drive space, but you’ll enjoy a slightly more private experience. Those temporary files which could contain sensitive information won’t be residing on your drive, waiting for prying eyes.