I would like my trash emptied every 30 minutes.

I installed Autotrash, but it specified days of age.

Is there an alternative?


1 Answer 1


You can create a simple script file and set it up in cron to run every 30 minutes.

Create a new file with your script. You can put it anyplace. In this example, we will put the script in your home directory's ~/.config

sudo nano ~/.config/emptytrash30.sh

Add the following:

find /home/yourname/.local/share/Trash/expunged/ -type f -exec rm {} \;
find /home/yourname/.local/share/Trash/files/ -type f -exec rm {} \;
find /home/yourname/.local/share/Trash/info/ -type f -exec rm {} \;

Save CTRL + O, and exit CTRL + X.

Make the script executable:

chmod +x ~/.config/emptytrash30.sh

Now set up cron to run the script every 30 minutes:

crontab -e

Choose an editor if you've never used cron before.

Add the following at the end:

*/30 * * * * /home/yourname/.config/emptytrash30.sh

This tells cron to execute your script every 30 minutes of every hour on every day, on every day of the week, on every day of the month.

Save CTRL + O, and exit CTRL + X.

  • I had to add this to the script. find /media/andy/MAXTOR_SDB2/.Trash-1000/files/ -type f -exec rm {} \; @Mirabeau
    – fixit7
    Aug 17, 2020 at 13:52
  • 1
    Yes you can of course add the "trash" of other HDs, as long as you understand the trick, no problem. Be careful, however, not to take the wrong path or make a typing error;) Remember to validate the answer if it meets your expectations: D
    – Mirabeau
    Aug 17, 2020 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .