Automatically take out the trash in Ubuntu

Start by installing the following package:

$ sudo apt install trash-cli

Then configure crontab like this:

$ crontab -e

Add a line to the crontab that looks like:

00 * * * * /usr/bin/trash-empty 7

Save the file and the crontab will update.

This means the system will very hour, on the hour, delete any files older than 7 days from the trash. The argument is the number of days in age that will be allowed. Putting 0 there trashes all files.