Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • Odd, that seems to specify that rm -rf . / (note the space) should print two warnings (for . and /) and exit, but we seem to get a question asking how to recover from that every couple months. Commented Sep 10, 2013 at 16:00
  • 6
    @Kevin Not all systems are POSIX compliant and the root directory restriction was only explicitly added in the latest POSIX release. Commented Sep 10, 2013 at 16:15
  • @jlliagre I see. GNU generally tries to implement POSIX (+extensions, of course), and I'd imagine they'd want to put this one in, but if it's fairly new that would explain it. Commented Sep 10, 2013 at 16:23
  • 2
    @Stephane: you're right, but I'd still add a big "Yes, it could happen! But ..." at the beginning of your answer, so that people undoubtedly know that indeed, on some (older or just non-POSIX compliant) systems, they could delete parent directories. I try to always point out those possibility (ie, I try to stay on the safe side, even if it makes the answer sometimes harder to read/remember) ^^ Commented Sep 10, 2013 at 17:49
  • 1
    @MartinSchröder, On BSDs, it was added somewhere between 2.8BSD and 2.10BSD (before only ".." was forbidden like in UnixV7) and between 3BSD and 4.3RENO. On SysV systems, it's less clear. HPUX manual for instance claims it only forbid ".." but in effect it forbids both "." and "..", it's only the manual that is not up to date. Commented Sep 11, 2013 at 12:19