Show HN: rm-safely – A shell alias that moves files to trash instead of deleting (github.com)
I made rm-safely, a simple shell wrapper that moves files to trash instead of permanently deleting them. It prevents accidental deletions from autocomplete mishaps or hasty rm -rf commands.
Should work as a drop-in replacement for rm but safer.
Would appreciate any feedback!
17 comments
[ 5.1 ms ] story [ 47.8 ms ] thread- Working great on MacOS!
- For some reason the latest versions occasionally didn't work on Windows 11. (I forgot the actual reason...)
I aliased rm=trash and RM=rm so I could still access the real rm when needed.
I hope it was fun.
In case you were wondering, this is at least four decades late on the invention front.
I have a small wrapper around rip2, aliased to `recycle`; files go to a `graveyard` zfs dataset. I deny `rm` usage for agents, a simple (global) instruction pointing to recycle seems to do the trick for Claude.
Seems like a quick win to remove some downside risk and make me a bit more comfortable letting agents run wild in local workspaces.
Editor backups, git, real backups.
They usually also follow XDG, and some are cross os.
I’m currently using https://github.com/Byron/trash-rs
Supports windows, macOS and Linux.