Is it true that Brian Kernighan while developing rm accidentally tested the project so that it removed itself? Then, according to story, he had to start over from the beginning because there was no backup. I heard the story from somebody but could not verify that it is true.

  • 7
    No-one called a single simple program a 'project' ... not sure whether that in itself casts doubt on the story.
    – dave
    Commented May 12, 2023 at 12:11
  • 19
    At 9:36am on May 12th the 'rm' project became aware. And promptly deleted itself.
    – Jon Custer
    Commented May 12, 2023 at 15:17
  • There is an anecdote in I think one of the Bell Labs papers about rm -r /. which would have the effect described.
    – user207421
    Commented May 13, 2023 at 10:38
  • 1
    It would be an easy mistake to make - remove argv[0] instead of argv[1] Commented May 17, 2023 at 16:21

1 Answer 1


rm is attributed to Ken Thompson and Dennis Ritchie (see the original man page, and the attribution in the Unix history repository), so the story in question doesn’t ring true.

Brian Kernighan was involved with Unix since very early days, so it’s still possible, but he wouldn’t have been a primary developer on rm. In any case rm is simple enough, even in V7, that its deletion wouldn’t have been much of a loss; it wouldn’t have taken long to re-create.

As an aside, specifying rm as a script’s shebang allows an executable to delete itself when executed (along with any file given as argument).

  • It's possible though that in retelling the story from memory the only detail the OP got wrong was who it happened to. Commented May 14, 2023 at 1:08
  • 4
    It's likely that, if one aspect of the story is false, others will be as well :-)
    – paxdiablo
    Commented May 14, 2023 at 7:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .