Ubuntu – Delete files from trash after x days


Is there any way to configure Ubuntu to permanently delete files from trash after a certain amount of time?

I don't get why that's not the default behavior in any major OS. I don't want to think about administrating my trash, but I don't want to accidentally delete something either. Am I the only one with that opinion?

Best Answer

Use trash-cli Install trash-cli (click image to install or run sudo apt-get install trash-cli).

Run trash-empty 30 to remove all files from trash which are older than 30 days. (You can change this number as you like.)

To automate this, add a command to Startup Applications:

enter image description here

Please note: If you use older Ubuntu versions than 12.04, the command is empty-trash!

Related Question