-1

Anyone ever actually tried rm -rf /*, or something similar, in Linux? You always hear people joke about it, but I'm curious if it actually executes, and if so, what kind of damage it actually does (not in terms of deleting disk).

kevlar1818
  • 3,055
  • 6
  • 29
  • 43

4 Answers4

2

Just for you, I tried it. I got a whole bunch of "rm: cannot remove ...", even with sudo. If you would like to try it out, I recommend VirtualBox and a copy of Ubuntu.

woz
  • 10,888
  • 3
  • 34
  • 64
1

Yes, I did, but only in a VM that could be reverted, just to test and demonstrate (I used to teach OS).

In older distributions it will execute and wipe out your distribution, but in most newer distributions this will fail.

If you want to try, do it in a place you don't care about, or in a VM that you can revert like me.

sam1370
  • 335
  • 2
  • 18
johnshen64
  • 3,734
  • 1
  • 21
  • 17
1

Have I "tried" it? No. Have I done it? Yes, and it's bad. However, if you're lucky:

  • You weren't logged in as root, so the damage will be minimal
  • You've installed safe-rm which will prevent stuff like this.
muffinista
  • 6,676
  • 2
  • 30
  • 23
0

Wikipedia : rm -rf (variously, rm -rf /, rm -rf *, and others) is frequently used in jokes and anecdotes about Unix disasters[2] . The rm -rf variant of the command, if run by a superuser on the root directory, would cause the contents of nearly every writable mounted filesystem on the computer to be deleted, up to the point the system itself crashes from missing some crucial file, directory, or the like.

http://en.wikipedia.org/wiki/Rm_(Unix)

I think some distros added a protection.

EDIT : muffinista gave the link to the protection.

cassln
  • 722
  • 2
  • 6
  • 18
Denys Séguret
  • 372,613
  • 87
  • 782
  • 758