Automatic recycle bin

03-12-2021 Nemo's trash can comes in handy. Sometimes you need it (to restore something). But often you forget it and then it quickly fills up.

Files older than 15 days are automatically removed from my trash. As a result, the hard disk never fills up and I still have a recycle bin if I accidentally delete something. Here is the content of the script:
trash-empty 15
Crontab to do this automatically every hour:
0 * * * * trash-empty 15
You need to install the trash command line tools:
sudo apt install trash-cli

How to use

Place the script in a file and make it executable with:
chmod +x
Run the script from inside a terminal window:


Put this script in crontab so that it runs automatically periodically:
crontab -e
View 30 more scripts