I would like my trash emptied every 30 minutes.
I installed Autotrash, but it specified days of age.
Is there an alternative?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityYou 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:
#!/bin/bash
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.
cron
nomination and this can help doing it from command line: askubuntu.com/questions/468721/…