Hacker News new | past | comments | ask | show | jobs | submit login
Rm -rf (justpasha.org)
65 points by fs111 on April 26, 2010 | hide | past | favorite | 17 comments



I'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.


I'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.


I 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.


I once wrote a variation of Larry Wall's file renamer (http://snipplr.com/view/2677/rename--larry-walls-filename-fi...) and called it 'rn'.

It's now called 'rename.pl'.


Maybe 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?




I 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.


Had 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!


Not 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).


Today I would boot a Knoppix, backup all user data and make a full reinstall.


The goal was to not have any major downtime.


That goal went out the window when you erased most of the machine.


/bin/login ??


Every 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.


With 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.


You can do this on real machines, too, with LVM2 snapshots.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: