Yeah, I figured all the parts talking about losing files were jokes. All the new guys know about unrm. Also useful is
ssh root@[remote] unshutdown
That’s called
wakeonlan <MAC address>
dumb question, how hard would it be to implement?
when most files are deleted, they aren’t removed from memory, just their indexes are.
how about rm just marks the index as discartable in case a new file needs space it can be saved there, but until then, rm can be reversed?
i think the better way would be to replace rm with something that just moves files to a trash bin like how graphical file managers do it.
if you were just pulling the data back off the disk, and you didnt notice it IMMEDIATELY or a background process is writing some data, it could still be corrupted.
there was something like that i had on win3.2 called like undel.exe or something, but same deal, often it was courupted somehow by the time i was recovering the data
I usually don’t think about it at all, but every now and then I’m struck by how terrifyingly destructive
rm -r
can be.I’ll use it to delete some build files or whatever, then I’ll suddenly have a streak of paranoia and need to triple check that I’m actually deleting the right thing. It would be nice to have a “safe” option that made recovery trivial, then I could just toggle “safe” to be on by default.
I think one solution is (browseable) Snapshots
Honestly, after re-reading my own comment, I’m considering just putting some stupid-simple wrapper around
mv
that moves files to a dedicated trash bin. I’ll just delete the trash bin every now and then…-Proceeds to collect 300 GB of build files and scrapped virtual environments over the coming month-
There are solutions already. Just use them instead of
rm
https://wiki.archlinux.org/title/Trash_management
Then can alias rm to
echo Use trash instead!
or something. You wanna build new habits, not co-opt rm, it could happen easily that you’re ssh’d into a system where your rm alias doesn’t exist or similar