Auto emptying trash in Ubuntu
trash-cli trashes files recording the original path, deletion date, and
permissions. It uses the same trashcan used by KDE, GNOME, and XFCE, but you can invoke it from the command line (and
scripts). Install trash-cli
with the below command:
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:
If you rarely restart your system, use cronjob
. You can install cronjob
with sudo apt install cron
and edit/create
your own crontab file with corntab -e
and add the below
Source: askubuntu