A safer rm alternative for developers
May 2026
The common safer-rm options all trade off convenience, coverage, and reliability. The right answer depends on whether you want a replacement command or a safety net under your existing workflow.
Common approaches
alias rm='rm -i' prompts before deletion. It is simple, but it gets noisy and still only covers rm.
trash commands move files to desktop trash. They help with deletes, but usually require remembering a new command and do not cover git reset --hard, sed -i, redirects, or overwrites.
Backups are essential, but periodic backups may miss a file created and deleted between snapshots.
The shell-hook option
oops lets you keep typing rm. Before destructive commands run, it backs up the affected files into local trash and records how to restore them.
The difference is coverage: oops also handles mv overwrites, git reset --hard, git clean -fd, sed -i, rsync --delete, redirects, and cleanup wrappers.
Install
For a deeper comparison, read trash for the command line. For exact command coverage, see the docs.