On Tuesday 26 September 2006 19:05, Greg Freemyer wrote:
Makes me think about rm -rf /. Another command I've never tried (and hopefully never will.)
Just to enlighten you a bit: i once had my laptop at work and it had an open shell window. When i wasn't looking, a Linux-knowledgable colleague of mine thought it would be funny to type in 'rm -fr /' and see if i got upset. He typed it in and showed me what he had done, with his finger hovering over the ENTER key, as if daring me to panic. Knowing i wasn't logged in as root, i reached over and tapped ENTER for him. As it turns out, when rm can't delete a directory, it doesn't dig deeper into subdirs and try to delete what it can. Instead it gives up and skips to the next dir at the same level as the one it failed to delete (as opposed to subdirs of that dir). Had it "tried really hard", and dug deeper after failing to delete /home, it would have reached /home/stephan and wiped out my home dir. The moral of the story is: if you're not root, and all of the dirs under / belong to root (or at at least not writable by arbitrary users), then 'rm -fr /' is 100% safe. Scary, but safe. -- ----- stephan@s11n.net http://s11n.net "...pleasure is a grace and is not obedient to the commands of the will." -- Alan W. Watts