Verdict: use it, with one rule. trash-cli does what it promises: trash-put moves a file into the same FreeDesktop trash your desktop’s file manager uses, and trash-restore brings it back. That has saved more weekends than any backup policy. But a trash can is storage, and nobody threat-models storage they think is empty. I “deleted” three versions of a .env file and found all three keys sitting in the trash, each labeled with the path it came from. I also trashed a secret on a RAM disk, and neither trash-list nor trash-empty could see it. Below is what I ran and the three habits that keep an undo button from becoming an archive. I have no relationship with trash-cli or its author. It’s GPL-2.0 (checked against GitHub’s API), and nobody paid me.
Picture the escalation. You rotate a leaked API key like a responsible adult: new key in .env, old file in the trash. You do it twice more over the year. A three-letter agency (or, more likely, a laptop thief with a free afternoon) opens ~/.local/share/Trash/files/ and finds your key rotation history, version-controlled better than your actual code, with the original path and deletion date of each one written next to it. Back to reality: the files keep their 0600 permissions and the trash directory is 0700, so another user on the box can’t read them. The real risk is duller. “Deleted” stopped meaning deleted on the day you installed this tool, and the trash goes everywhere your home directory goes: backups, sync clients, the disk you sell on eBay.
SEVERITY: your backup provider. ATTACK VECTOR: a folder named Trash, which no one has ever opened on purpose.
Everything below ran for real with trash-cli 0.26.9.29, installed with pipx install trash-cli on Python 3.14, Ubuntu, in a throwaway HOME so my real trash stayed out of it. The keys are fake (sk_test_…). The exit= lines come from an echo "exit=$?" I ran after each command, not from trash-cli.
What earns the install
One command, and the file is gone from where you were looking:
$ ls -l .env
-rw------- 1 runner runner 37 Nov 28 23:00 .env
$ trash-put -v .env
trash-put: '.env' trashed in ~/.local/share/Trash
exit=0
$ trash-list
2026-11-28 23:00:37 /tmp/tc/home/proj/.env
It writes the same layout the FreeDesktop trash spec describes: the file goes to files/ and a small .trashinfo note goes to info/, so your desktop’s trash icon and the terminal agree. Permissions were handled the way I’d want. The file kept -rw------- and the trash folders were created drwx------. It also handles directories with no -r. I trashed a 200 MB directory and df didn’t move, because on the same filesystem trashing is a rename, not a copy. (It also didn’t free a byte. Hold that thought.)
The part where deleting a secret keeps it
Here is the note it leaves behind, and here is what happened after I rotated that key twice, trashing the old .env each time:
$ cat ~/.local/share/Trash/info/.env.trashinfo
[Trash Info]
Path=/tmp/tc/home/proj/.env
DeletionDate=2026-11-28T23:00:37
$ ls -A ~/.local/share/Trash/files/
.env
.env_1
.env_2
$ grep -r "sk_test" ~
/tmp/tc/home/.local/share/Trash/files/.env_2:STRIPE_KEY=sk_test_rotated_44
/tmp/tc/home/.local/share/Trash/files/.env_1:STRIPE_KEY=sk_test_rotated_43
/tmp/tc/home/.local/share/Trash/files/.env:STRIPE_KEY=sk_test_not_a_real_key_42
Nothing broke. That is the feature: name clashes get _1, _2, and nothing is ever overwritten, because an undo you can’t trust is worse than none. It just means a secret you deleted is now a secret you stored, in plain text, with a label. Every convenience is an attack surface with better marketing, and this one’s marketing is the word “delete.”
The part where it can’t find its own trash
On a filesystem other than your home’s, trash-put doesn’t copy the file home. It makes a per-volume trash can at the top of that mount, named .Trash-<your uid>. I tried it on /dev/shm, the RAM-backed tmpfs every Linux box has:
$ cd /dev/shm && trash-put -v lh-secret.txt
trash-put: 'lh-secret.txt' trashed in /dev/shm/.Trash-1001
exit=0
$ trash-list
2026-11-28 23:00:41 /tmp/tc/home/proj/.env
2026-11-28 23:00:37 /tmp/tc/home/proj/.env
2026-11-28 23:00:41 /tmp/tc/home/proj/.env
$ trash-list --trash-dirs
/tmp/tc/home/.local/share/Trash
$ trash-empty --dry-run
would remove /tmp/tc/home/.local/share/Trash/files/.env_2
would remove /tmp/tc/home/.local/share/Trash/info/.env_2.trashinfo
would remove /tmp/tc/home/.local/share/Trash/files/.env
would remove /tmp/tc/home/.local/share/Trash/info/.env.trashinfo
would remove /tmp/tc/home/.local/share/Trash/files/.env_1
would remove /tmp/tc/home/.local/share/Trash/info/.env_1.trashinfo
The put works. Then the list and the empty both act as if that can doesn’t exist. The reason is in the source, not a bug report: trashcli/fstab/mount_points_listing.py only scans mounts whose filesystem type is “physical” (by psutil’s definition) plus an allow-list (nfs, btrfs, a few fuse types). tmpfs isn’t on it, so trash-list --volumes printed /, /boot, /boot/efi and two snap mounts, and nothing else. To be fair to the tool, /dev/shm is RAM and forgets everything at reboot, so this exact can empties itself eventually. The lesson is bigger than one mount, though: trash-put and trash-empty don’t agree on which volumes exist, and only one of them tells you where it put things.
The three mitigations that matter
I ran each of these in the sandbox above, ranked by how much risk they remove.
1. Secrets don’t go in the trash. Take back the ones that did. For a file whose whole point is to stop existing, use rm and skip the safety net. For the ones already in there, trash-rm removes trashed files by pattern, which also covers the _1, _2 copies:
$ trash-rm '.env*'
exit=0
$ grep -r "sk_test" ~
grep exit=1
The grep exit=1 line is grep finding nothing, which is the result you want. The honest walk-back: rm and trash-rm unlink a file, they don’t scrub the disk, and on a modern SSD nothing else reliably does either. A key that sat in plain text should be rotated at the provider, not just deleted, and that was true before trash-cli showed up.
2. Put an expiry date on the trash. trash-empty takes an age in days. I back-dated one entry to 1 October and ran it with 30:
$ trash-list
2026-11-28 23:01:09 /tmp/tc/home/fresh.txt
2026-10-01 09:00:00 /tmp/tc/home/big
$ trash-empty --dry-run 30
would remove /tmp/tc/home/.local/share/Trash/files/big
would remove /tmp/tc/home/.local/share/Trash/info/big.trashinfo
$ trash-empty -f 30
exit=0
$ du -sh ~/.local/share/Trash
20K /tmp/tc/home/.local/share/Trash
Today’s file stayed and the old 200 MB directory went. Put trash-empty -f 30 in a cron job or a systemd user timer and the trash becomes a 30-day undo window instead of a permanent archive. This also fixes the disk space surprise from earlier.
3. Go find the trash cans trash-list can’t see. Any mount trash-cli skips can still hold a .Trash-<uid> directory. Look for them where removable and RAM-backed filesystems live, then point --trash-dir at each one:
$ ls -d /dev/shm/.Trash-*
/dev/shm/.Trash-1001
$ trash-empty --dry-run --trash-dir /dev/shm/.Trash-1001
would remove /dev/shm/.Trash-1001/files/lh-secret.txt
would remove /dev/shm/.Trash-1001/info/lh-secret.txt.trashinfo
$ trash-empty -f --trash-dir /dev/shm/.Trash-1001
exit=0
$ ls -A /dev/shm/.Trash-1001/files
The last ls printed nothing, so the can is empty. I only tested /dev/shm. Your list depends on your mounts: run trash-list --volumes and compare it with findmnt, and anything in the second list but not the first is a mount where you should check for .Trash-* yourself. USB sticks deserve special attention, since the stick’s .Trash-<uid> folder, and every secret in it, leaves with the stick.
While we’re here: don’t alias rm
The tempting move is alias rm=trash-put. The tool’s own README says “You can but you shouldn’t”, because the two look compatible and aren’t: trash-put accepts -r and -f but ignores -r and happily trashes directories without it, which I confirmed with the 200 MB directory above. Retrain your fingers with the README’s suggested alias, alias rm='echo "This is not the command you are looking for."; false', and reach for \rm when you mean it. That also makes mitigation 1 a deliberate act, which is the point.
Bottom line
trash-cli is a good tool that does one job well: it gives your terminal the same undo the desktop has. The risk isn’t a flaw in it. “Delete” now means “move somewhere I’ll forget about,” and that somewhere keeps the content, the original path and the date, with no expiry, on every filesystem you trash things on, including some the tool won’t list. Keep secrets out of it, age it out on a timer, and check the cans it can’t see. Source and docs: github.com/andreafrancia/trash-cli.