News for hackers. Stuff that matters.
Re:Rm -rf by sunkencity on Monday April 26, 2010 @05:21AM (#1294470)
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.
Re:Rm -rf by nailer on Monday April 26, 2010 @07:11AM (#1294579)
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.
Re:Rm -rf by bellybutton on Monday April 26, 2010 @09:03AM (#1294757)
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.
Re:Rm -rf by philjackson on Monday April 26, 2010 @10:49AM (#1294984)
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'.

Re:Rm -rf by jdietrich on Monday April 26, 2010 @09:58AM (#1294854)
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?
Re:Rm -rf by sp332 on Monday April 26, 2010 @11:25AM (#1295080)
Re:Rm -rf by wtn on Monday April 26, 2010 @05:22AM (#1294471)
Re:Rm -rf by olivier101 on Monday April 26, 2010 @08:15AM (#1294665)
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.
Re:Rm -rf by rm-rf on Monday April 26, 2010 @08:33AM (#1294693)
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!

Re:Rm -rf by rsl7 on Monday April 26, 2010 @10:08AM (#1294875)
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).
Re:Rm -rf by ulrich on Monday April 26, 2010 @05:12AM (#1294460)
Today I would boot a Knoppix, backup all user data and make a full reinstall.
Re:Rm -rf by dalore on Monday April 26, 2010 @06:38AM (#1294545)
The goal was to not have any major downtime.
Re:Rm -rf by jrockway on Monday April 26, 2010 @08:34PM (#1296744)
That goal went out the window when you erased most of the machine.
Re:Rm -rf by patterned on Monday April 26, 2010 @02:14PM (#1295465)
/bin/login ??
Re:Rm -rf by steveklabnik on Monday April 26, 2010 @10:58AM (#1295010)
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.

Re:Rm -rf by lsb on Monday April 26, 2010 @08:33AM (#1294694)
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.
Re:Rm -rf by jrockway on Monday April 26, 2010 @08:35PM (#1296745)
You can do this on real machines, too, with LVM2 snapshots.