I Deleted the Wrong Files (Again) — So I Built a Safer Trash CLI for Linux
muxueqz.top·11h·
Discuss: r/commandline
Flag this post

If you’ve ever worked on Linux long enough, you know this story: you run a quick rm -rf something/, and only afterward realize… it was the wrong directory.

That happened to me (again). I tried to recover the data using xfs_undelete, but as often with XFS, the recovery failed — the deleted files were gone forever.

So instead of relying on recovery tools, I decided to make deletion itself safer. That’s how my small script, trash.sh, was born.


🗑️ What trash.sh Does

trash.sh is a lightweight Bash script that replaces risky rm operations with something safer. Instead of permanently deleting files, it moves them to a .trash directory on the same partition, appending a timestamp to avoid name conflicts.

Examp…

Similar Posts

Loading similar posts...