AUTOTRASH(1)
๐ธ AUTOTRASH(1) โ or, how to make your trash can stop hoarding ๐
okay so first things first bestie: this is autotrash, from the General Commands Manual (section 1, the classics โจ), and it's about to become your new favorite little cleanup gremlin. let's go ๐ง
โจ NAME โจ
autotrash โ a program to automatically purge old files from the FreeDesktop.org trash ๐๏ธ๐
like literally it goes into your trash and evicts the old stuff so you don't have to. no cap.
๐ฆ SYNOPSIS ๐ฆ
autotrash [-d purge_n_days_old]
autotrash [โdelete number_of_megabytes_to_purge]
autotrash [โkeep-free number_of_megabytes_to_free]
three moods, three shapes of invocation. pick your fighter ๐
๐ธ DESCRIPTION ๐ธ
So autotrash is a program that looks in a FreeDesktop.org Trash folder for info on what's inside it, and then purges a part of the trash depending on which options you gave it. That's the whole vibe.
The most common option is -d, which purges files that have been sitting in the trash for more than a given number of days. bye girl ๐
The option โdelete will remove at least the given number of megabytes from the trash, and it removes the oldest trash first. oldest-first, always. respect the queue ๐ซถ
Using โkeep-free makes sure at least the given number of megabytes of free space is available, by automatically setting โdelete to the right value. for example, to keep at least 1GB of free space โ removing files from the trash if needed โ you'd run autotrash โkeep-free 1024. iconic. it does the math so you don't have to ๐งฎโจ
๐ OPTIONS ๐
This program follows the usual GNU command line syntax, with long options starting with two dashes (-). classic, we love a consistent king ๐
-h,โhelpโ shows a summary of options. your little map ๐บ๏ธ-d DAYS,โdays DAYSโ purges files older than DAYS number of days. the og move ๐ซ-T PATH,โtrash-path PATHโ use the given path as the location of the Trash directory instead of the default:~/.local/share/Trash. yes you can point it somewhere else, she's flexible ๐โmax-free Mโ only purges files if there's less than M megabytes of free space left at the trash location. so like, if you set this to1024, thenautotrashwill only start to work if there's less than 1GB of free space in the trash. until that time,autotrashwill just exit normally without scanning the Trash directory at all โ she peeks, she leaves, no drama ๐. if unsure, try runningautotrashwithโdry-runandโverboseto see the effect ๐โdelete Mโ purges at least M megabytes, deleting oldest trash addition first. important: it uses trash entries, NOT individual files โ ๏ธ. this means that if your oldest trashed item is a 1GB directory and you request at least 10MB to be removed (M=10),autotrashwill remove 1GB. yeah. the whole 1GB. it's giving all-or-nothing ๐. if unsure, try runningautotrashwith bothโdry-runandโstatto see the effect.โmin-free M,โkeep-free Mโ makes sure there's a minimum of M megabytes of free space. if there's less free space, it setsโdeleteto the difference between M and the amount of free space. if unsure, try runningautotrashwithโdry-runandโverboseto see the effect ๐โtrash_limit Mโ makes sure the trash doesn't consume more than M megabytes. if more space is consumed, it setsโdeleteto the difference between M and the amount of space consumed by the trash. a literal cap on the hoard ๐ฅ-D REGEX,โdelete-first REGEXโ purges any file which matches REGEX first, regardless of its timestamp. REGEX must be a valid regular expression. if this option is used multiple times, the files matching the first regular expression are deleted first, then the second, etc. priority list, main character energy ๐ Example: delete any.avifiles first, then by age:โdelete-first.*.avi'`-v,โverboseโ outputs information on what's happening and why. she narrates ๐ฃ๏ธโจ-q,โquietโ only outputs warnings. minimalist era ๐คซโcheckโ reports.trashinfofiles that point to a non-existing file. this will only happen with a broken Trashcan ๐ญ. it's left up to you, the user, to actually do something with this information. these files will be removed as soon as the mentioned file would be removed byautotrash.โdry-runโ only lists what would be done, but actually does nothing. dress rehearsal ๐ญโstatโ shows the number and total size of files involved. receipts ๐-V,โversionโ shows the version of the program. say hi ๐
๐จ The exit status ofautotrashwill be 1 if a corrupttrashinfofile is found. that's your signal something's weird, bestie, don't ignore it.
๐ EXAMPLES ๐
Examples of program use. come get your demo, this is the fun part ๐
autotrash -d 30โ purge any file that has been in the trash for more than 30 days. clean, simple, effective โจautotrash โmax-free 1024 -d 30โ only purge files from the trash if there's less than 1GB of space left on the trash filesystem. if so, only trash files that are older than 30 days. conditional queen ๐autotrash โmin-free 2048โ purge files from trash, oldest first, till there's at least 2GB of space on the trash filesystem. there's no restriction on how old trashed files are. age is just a number ๐ซautotrash โmin-free 2048 -D.\.bak' -D.*\\.avi'โ purge files from trash till there's at least 2GB of space on the trash filesystem. if we need to remove files, make sure we remove.bakfiles first, then all.avifiles, and after that the oldest to the newest. there's no restriction on how old trashed files can get. please note that.*\.bakand.*\.aviare regular expressions and not glob patterns ๐ง . given that they're regular expressions, using-D..(png|gif|jpg|jpeg)'` will match images with any of the given extensions. regex girlies rise ๐ฅautotrash โmax-free 4000 โmin-free 2048 -d 30โ start reading the trash if there's less than 4000MB of free space, then start keeping an eye on it. at that point, remove files older than 30 days, and if there's less than 2GB of free space after that, remove even newer files. escalation arc ๐autotrash โtrash_limit 200 -d 30โ remove files older than 30 days. if the trash consumes more than 200MB, remove even newer files. boundaries. set them ๐@hourly /usr/bin/autotrash โmax-free 4000 โmin-free 2048 -d 30โ experienced users should consider addingautotrashas a crontab entry, usingcrontab -eand adding the line above. set it and forget it, the highest form of self care ๐งโโ๏ธ
๐ COPYING ๐
Copyright ยฉ 2015 Bram Neijt bneijt@gmail.com
This manual page was written for the Debian system (and may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. ๐
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. there ya go, all the legal lore ๐ซถ
โญ AUTHORS โญ
A. Bram Neijt bneijt@gmail.com
and that's the whole page bestie ๐ this was AUTOTRASH(1) from the General Commands Manual, section 1, and it's filed under AUTOTRASH(1) on the way out too โ same name, same page, no version bump, no date drama, just good clean trash-purging documentation. go forth and empty responsibly ๐ธ๐ฆโจ
๐ฆ where this page comes from
- nixos 26.05: python3.13-autotrash 0.4.7
- nixpkgs unstable: python3.14-autotrash 0.4.7
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms