Like Windows, Linux GNOME Desktop has option to automatically clean up trash and/or temporary files older than certain days. This may help free up disk space while keeping files for a period of time in case you want to re-use them.
And, here’s how to enable this option in Ubuntu, Fedora, Debian, and other Linux running GNOME desktop.
Option 1: Enable Trash/Temp File Auto Deletion via Settings:
Firstly, go to upper right corner system tray menu and click to open ‘Settings‘.
Next, navigate to “Privacy” from the left pane in Gnome control center (aka System Settings):
Under ‘Privacy’ settings, finally go to ‘File History & Trash‘ and there you’ll see the toggle icons to enable trash content and temporary files auto-deletion, as well as option to change the time period.
Option 2: Linux Command to Enable Recycle Bin Auto Deletion:
Firstly, press Windows/Super on keyboard to bring up ‘Activities’ overview screen. Then, search for and open terminal:
When terminal opens, copy and paste the command below into it and hit Enter will do the trick:
gsettings set org.gnome.desktop.privacy remove-old-trash-files true
By default, it deletes old files from Recycle Bin older than 30 days. You may change the time period, e.g., to 10 days, using command:
gsettings set org.gnome.desktop.privacy old-files-age 10
In addition for old temporary files auto deletion, use command:
gsettings set org.gnome.desktop.privacy remove-old-temp-files true
Option 3: Toggle the option via Dconf Editor:
Though the previous two methods is well enough, there’s also another way to do the configuration. Firstly, search for and install ‘Dconf Editor’ from Software app.
Next, search for and open ‘Dconf Editor’ from the overview screen. Then, navigate to “org.gnome.desktop.privacy“.
There you’ll see the keys for trash and temporary files auto deletion, old-file-age, as well as some other options for privacy. Just change the values as you prefer will apply the change immediately.
That’s all. Enjoy!