4 ms·
For me, it was when I meant to execute this... rm -rf ~/foo ... but executed this instead: rm -rf ~ /foo
by rectang 10y ago
For me, it was when I meant to execute this...
rm -rf ~/foo
... but executed this instead:
rm -rf ~ /foo
- BinaryIdiot 10y agoI did the Windows equivalent once a long time ago (I think it's deltree?) and I did it on a university computer system. It cleared out a TON of files and the computer itself pretty much stopped working. I had to hard turn it off. Fortunately the University was using some tool that can re-image a computer each time it boots before hitting Windows so starting it back up and all the deleted system and application files were back.
- overcast 10y agoProbably Ghost server, that's why schools do this.
- meowface 10y agoFor me it was a simple `rm -rf .`. Thought I was in ~/somefolder/, was actually in ~... I stopped it after about 3 seconds, but that was enough to do critical damage.
- cjbprime 10y agoMy worst data loss was: $ tar cvfz mbox outbox mbox.tar.gz The argument order is backwards -- the output file is supposed to be first, then the input files. On my system, this overwrote my full mailbox with a gzipped copy of my outbox, and a complaint that the mbox.tar.gz input file didn't exist. That's right, the worst data loss happened while I was trying to take a backup. :(
- chuckdries 10y agoWhat were you trying to do? What's the outbox argument for?
- dasil003 10y agoHe was trying to backup his mbox and outbox.
- deleted 10y ago[deleted]
- dsavinkov 10y agothis is the reason why I always use quotes before specifying folders with rf -rf :)
- memracom 10y agoI always type ls /stuff/wherever/* Then examine the output to see if that is the stuff I really want to delete and if it is, up-arrow Ctrl-A right right backspace backspace rm -rf enter Never deleted the wrong stuff again in 30 years of doing that
- was_boring 10y agoI always cd to the parent directory, ls with tab complete to check, the rm with the same tab complete.
- okbake 10y agoSomething else that is really useful in these situations (in bash at least) is alt-* (alt-shift-8). It will expand a directory or glob into all effected top level files/directories. For example, it will expand `ls *` to `ls foo bar baz`, etc
- bartvk 10y agoGreat tip, thanks!