3 ms·
Not working anymore on Python3 (tried it after rm -rvf ./ *)
by rvnx 2y ago
Not working anymore on Python3 (tried it after rm -rvf ./ *)
- freedomben 2y agoTangential, but funny story, I once ran that exact command but the . key didn't register, and (out of habit) I hit enter before I was able to notice. I learned a valuable lesson that day about testing recovery from backups before you need them. I also learned a lesson about only running commands in a root shell when you really need to be root.
- radlad 2y agoI once spent an entire night setting up a new Macbook. Early in the morning, bleary eyed, I cloned a directory to ~/project. I must've quoted it, because it created a directory called "~". Without a thought, I typed `rm -rf ~` and hit enter. Oops.
- 5e92cb50239222b 2y agoI just don't use rm directly, unless it's something very trivial and non-recursive. Start with ls, write out your path, execute it and check the results. If it looks fine, Ctrl+P → Ctrl+A → Alt+D → rm → Enter. Takes maybe two seconds more than just using rm, and definitely saved me more time over the years.
- jjnoakes 2y agoI have a similar habit. I usually do "echo rm ..." or "echo destructive command ..." first, check the output (so wildcards are expanded, etc), and if I'm happy I bring the command back in the history and edit out the echo.
- jmholla 2y agoIn bash, you can alternatively replace your shortcuts Ctrl+P → Ctrl+A → Alt+D with `!:1-$`, where 1 is the index of the first argument you want from your previous command. So: ls [files ...] rm !:1-$ I personally find it faster to use bash's history expansion. But, we're talking about subsecond differences here.
- c17r 2y agoYou can also do: $ ls [files ...] $ ^ls^rm
- ikari_pl 2y agoi imagine it's the "we'll laugh at it in a year" kind of funny
- cbsks 2y agoTo save the rest of us from the same fate, ‘rm -rf /‘ has been disabled by default since coreutils 6.2 in 2006: https://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=89ffaa19909d31dffbcf12fb4498afb72666f6c9 https://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commi...
- themoonisachees 2y agoMy first thought was "this won't work without --no-preserve-root"
- hansvm 2y agoVery tangentially related, the last time I nuked a computer it was with FUSE shenanigans. I used a secure temporary directory as the mount point, and the language's destructor effectively did a hidden rm -rf on the contents when I was done with it after the unmount silently failed.