67

Ken Thompson, the creator of Unix, was once asked what he'd do if he had it to do over again. He said, "I'd spell creat with an 'e'."

What is Ken referring to? Is there a "creat" command?

Kusalananda
  • 333,661
  • 1
    Actually, he most likely didn't mean what he said: he probably meant that he'd spell creat with two 'e's - after all, one is already present. Of course, the implicit message being that UNIX turned out the way it was meant to be without any substantial changes only requiring fixing this [one] typo. – Dietmar Kühl Feb 06 '17 at 11:22

4 Answers4

58

It's a Unix system call that creates a file: At a Unix shell prompt, type man 2 creat to learn more.

Man pages are also available online these days:

Peter Cordes
  • 6,466
  • 34
    BTW, he finally did it: https://github.com/golang/go/commit/c90d392ce3d3203e0c32b3f98d1e68c4c2b4c49b – myaut Jul 09 '15 at 21:02
37

Not only he refers to man 2 creat system call. He also refers to the obsolete trends to save on every tiny character, where possible, sometimes this being only confusing, especially now, when typing and storing another character is rarely an obstacle.

P Shved
  • 1,481
  • 18
    I think in the context of the question he was only referring to creat(). The point he was making was there was nothing about Unix he would have done differently except for this small spelling error in the system call to create a file. –  Nov 11 '09 at 08:04
  • 17
    @jmucchiello, it's not a spelling error. It's a deliberate (albeit non-standard) abbreviation. It fits with the heavy use of abbreviations like fcntl, ls, mv, etc, in general. – Matthew Flaschen Apr 13 '11 at 19:15
  • 9
    Agree, but I love those abbrvtns even when we have TBs to store :) – tgkprog Jun 10 '13 at 19:06
  • 2
    Teletype keys are hard to press. It was beneficial to save a few letters. First ones that could be eliminated were vowels and redundant consonants. – Erkin Alp Güney Apr 26 '17 at 11:15
  • It's a false economy to use terse variable names, because we almost always read code more than we write it. – dstromberg Feb 20 '20 at 18:31
  • 1
    It's not false economy when Teletype keys are involved. – Harsh May 06 '22 at 17:32
32

I'm six years late to answer, but I believe that the extant answers all miss the point of Thompson's quote.

I'd spell creat with an 'e'.

Ken Thompson is not lamenting the name of the function used to open and possibly create a file. Rather, he is expressing that Unix was done properly, i.e. there is nothing major that should have been done differently.

The subtle point is that Unix architecture is sound, and the implementations are fine. One would need to bikeshed to find anything to improve in Unix. Thus, the obvious nitpick about the name of a common system call.

dotancohen
  • 15,864
  • 4
    Right, he wants to tell us, that the UNIX architecture can be improved in very tiny aspects. But basically UNIX has done it right. BTW. creat is a system call not a CLI command. – ikrabbe Jul 09 '15 at 20:59
25

It refers to the UNIX system call to create new files. Linkers on some machines were limited to identifiers of at most 6 characters. Apparently, Ken had to work with such a linker and hence the create system call was shortened to creat to match this limitation. The irony is that create does too.

See also: What does the 9th commandment mean?

ubiyubix
  • 359
  • 15
    The 6 character limit translated to 5, as the compiler (in order to avoid user symbols clashing with compiler generated ones) prepended a '_' before user variable/function names, and was careful not to use '_' when generating symbols. – vonbrand Mar 14 '13 at 01:08
  • 4
    @vonbrand: That doesn't seem to explain how unlink or umount could exist, however, which I would think are contemporary with creat. – Dolda2000 Jul 11 '15 at 06:23
  • 2
    @Dolda2000 Well, it's quite possible the linker had this limitation, while the compiler did not. So umount would clash with umoun or umounx or whatever, but the name would be allowed. But that's pure speculation :) – Luaan Jul 12 '15 at 07:32