6 ms·
Rm -rf
- ulrich 17y agoToday I would boot a Knoppix, backup all user data and make a full reinstall.
- sunkencity 17y agoI've seen a pro sysadmin deal with the loss of all device files on a linux box by just uuencoding them in one terminal on a working machine and then pasting them into the other terminal and piping them back from standard in. Pretty impressive and not even breaking sweat.
- wtn 17y agoSee also: http://news.ycombinator.com/item?id=1212051 http://news.ycombinator.com/item?id=1212051
- nailer 17y agoI've been using Linux for 8 hours a day for 13 years and never done this. I use GNU's alternate syntax, which is easier: rm [object] [options] Eg, rm /var/tmp/foo -rf If you hit enter too early, nothing bad happens. Obviously doesn't work on HPUX, Solaris, DGUX or Ultrix, but if you're using those you have other issues.
- bellybutton 17y agoI always put a comment at the beginning of nontrivial commands, so accidentally hitting enter prematurely doesn't do anything and so I can check it once it's written out before removing the comment and hitting enter.
- olivier101 17y agoI once typed rm -rf /bin instead of rm -rf bin on AIX. I Ctrl-C'ed quickly but all commands in /bin beginning with A and B and some C had vanished... The big problem is that the huge majority of AIX commands rely on awk, which had vanished together with all A's... Eventually had to reinstall system from tape.
- rm-rf 17y agoHad a similar thing happen the first time I used a GUI to admin a Linux box. I had a fresh install and was doing my usual post-install hardening (removing unneeded packages & users). The GUI had a checkbox for removing the users home directory. Things were going good until I removed the user 'mail' whose home directory was '/'. Doh!
- lsb 17y agoWith virtualized machines, you can make a hot backup every day, so if something egregious like this happens on a virtualized machine you can (at most) lose a day's work.
- jrockway 17y agoYou can do this on real machines, too, with LVM2 snapshots.
- jdietrich 17y agoMaybe it's me being an old weirdy beardy, but what's with all the oooooold hacker folklore on HN recently? I keep expecting to see someone post 'more magic'. Can we not just post a link to the Jargon File and be done with it?
- sp332 17y agoFine. http://news.ycombinator.com/item?id=1295076 http://news.ycombinator.com/item?id=1295076
- rsl7 17y agoNot a very scalable solution, but if there is a file named -X where X is any option to rm, * will expand to catch it, and if illegal, rm will exit without doing anything. Someone taught me that in college back in the day (sequent/dynix).
- philjackson 17y agoI once wrote a variation of Larry Wall's file renamer (http://snipplr.com/view/2677/rename--larry-walls-filename-fixer/ http://snipplr.com/view/2677/rename--larry-walls-filename-fi...) and called it 'rn'. It's now called 'rename.pl'.
- steveklabnik 17y agoEvery time I read this story, I feel upset when I think about how many people tell me I'm "good with the command line." Maybe someday I'll ascend to UNIX godhood... I know that I'd have been screwed in this situation.