It's always been surprising to me that their isn't a built in "undo" to `rm`
e.g. why doesn't `rm` just move files to /tmp?
It's always been surprising to me that their isn't a built in "undo" to `rm`
e.g. why doesn't `rm` just move files to /tmp?
The default rm doesn't do this because shell users are supposed to be able to figure out how not to delete things they want to keep.
Kind of like not pointing a gun at people who you don't want to kill.
The undo for rm is regular backups.
On my system I have snapshots of my home directory created every 15 minutes. Not quite the same thing, but it also helps me when I have incorrectly modified a file.
And do what when tmp gets full and services & applications start crashing?
When someone implements that undo, someone's going to need to write a tool that really does remove files, really. Will the next guy wonder why really-rm doesn't have undo built in?
Same question as parent: "And do what when tmp gets full and services & applications start crashing?"
It's not rocket surgery.
We could all just work with WORM drives instead.
Have a look at either the `trash-cli` package by Andrea Francia.
I don't do this because my idiocy must be punished disproportionately. Also, you end up automatically pressing y enter.
Aliases can be way more dangerous; think about what you're doing. This is what backups are for.