Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

dead tired, 4am in the morning working on a client app for a huge client of theirs (I was subcontracting) was trying to remove everything inside a folder and instead of going

rm -rf ./*

I went

rm -rf . (can't get the wildcard thingamajig to show up)

It took me a second to understand why the command was taking so long to run, by the time I figured it out and killed the command, I had wiped out almost half of what was on the drive.

Biggest "oh. my. god" moment of my life. I think I had an actual panic attack for a bit even.

Luckily, media temple had a backup from just a few hours earlier (I was lucky, they only ran them periodically and it just so happened to fall on that day).



Wouldn't that just delete the folder instead of emptying it?


Back in the day, rm followed .. if you specified it on the command line. It went like this:

You are in .; The current directory listing include ..; Recursively deleting everything deletes everything on the drive.

Actually, I think the one time I saw someone do this, wildcards were involved. And I was going to explain, but the comment system is making my asterisks into bold markers.


I can't get the wildcard character to show up ... it should be x.x


You can prepend two spaces to insert <code> (http://news.ycombinator.com/formatdoc):

  rm -rf ./*
  rm -rf  *.*
To stay on topic, because of this thread, I just added alias rm="rm -I" to .bashrc, and I have never yet needed -f.




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

Search: