1. 23
    1. 12

      The first version that had pwd was Unix Version 5 (or “Research Unix 5”, not to be confused with the later System V) from June 1974. I can’t find any manpages for this edition, but I did find the source:

      prname() {
      	name[off] = '\n';
      	write(1,name,off+1);
      	exit();
      }
      

      Which, presumably, stands for “print name” or “print pathname”. I don’t know what else to make out of it anyway.

      The manpage from the 6th and 7th edition do mention “prints the pathname” in the description, just not in the summary. I wouldn’t be so quick to dismiss it.

      $PWD was added much later in ksh88, and “print” here indeed doesn’t make much sense, but if I’d had to guess it was added as a “cache” for the pwd output, so it makes sense to use the same name (even though it’s awkward). I can’t find the source for ksh88 right now (I don’t think it’s available?), but from a quick glance it seems this is how it’s used in ksh93 where it keeps a global “state” struct with, among other things, a pwd field.

      These kind of things get backronymed all the time, but it seems to me that “print” is by far the most likely original meaning, especially considering the Multics lineage as you mentioned.

      1. 3

        Lovely, thank you so much for the very interesting comment and for confirming when pwd first appeared (in fact I had also found the (same) source in V5 albeit in a different place but wasn’t sure if that was the first occurrence in Unix version history).

        I agree that “print” sounds sensible and logical, but there’s something inside me that wants to resist that (despite the Multics lineage!).

        I’m only recently discovering an interest for historic Unix artifacts, I guess I missed the 50th celebrations - or perhaps they indirectly spurred me on. Anyway, thanks!

        1. 8

          Usually the OpenBSD manpages are a good place to look if you want to know when something first appeared, there’s usually a “history” section at the bottom and they did quite some work getting it all filled correctly in some years ago.

    2. 3

      I’d say that Multics is the most likely origin of pwd (I’d wager, dmr and ken were adopting command names they have stored in their muscle memory).

      That said, the unix heritage society’s mailing list (archive) might be worth contacting (if you still care); ken himself hangs out there.

      1. 1

        (Author here) - Thanks, that’s a good suggestion. I checked the mailing list out, and note that subscription is not directly available (I should, rather, email Warren Toomey) which is probably better - I can dive into the archives first.

    3. 2

      I have never heard of the P in pwd standing for anything but “print”, so this was a surprise. The post makes a good case for why “pathname” is actually more likely to be the true origin. But after reading the last paragraph, I’m now convinced that the original programmers themselves didn’t agree which it was, and if you could go back and ask them, they would have given different answers.

      1. 1

        (Author here) - That’s a fascinating point, that perhaps the original programmers also didn’t agree. I’d never considered that, but it’s definitely possible!

    4. 1

      After the click-baity title I expected something slightly more interesting and more numerous. It was about a single meaning, not a myriad of meanings:

      A command named pwd (also having a shell builtin of same name for performance reasons.

      I expected to learn of new things under the same name, to get useful knowledge of possible pitfalls where having a preconception of what PWD would represent would cause me trouble.

      1. 4

        I agree. I don’t like to poo-poo other people’s work in general but I’m not sure I can think of a reason it matters whether the p in pwd means “print” or “present”, or why one would want to lobby for one or the other since they are, at a very practical level, exactly thee same thing.

        If I was going to lobby for one or the other, it makes more sense to default to “print” since early Unix terminals were literally teletype machines. As a result, both C and Unix have long used the very “print” to mean display, present, echo, show (or any other synonym you care to think of) data to the user or stdout/stderr.

        But I guess the thing that disappointed me the most was the author’s attempt to discredit the Wikipedia source by quoting the man page. The article says “there are actually zero references to pwd being short for ‘print working directory’” and yet right there in the screenshot the man page literally says, “prints the pathname of the working (current) directory”. Yes, you have to remove an “of” and a couple of “the’s” but it says so right there!

        1. 2

          (Author here) - Oh dear, that’s not good, sorry to have disappointed you. But while you aren’t sure you can think of a reason it matters enough to write a little post about it … I could think of one - my growing fascination with Unix history and how things grow, merge, and fork. And so I wrote it. Moreover, I wasn’t lobbying for one or the other, as you can see from the content of the post.

          Regarding your last point, I guess it’s down to how literally one interprets the written word. For me, if one is “looking for” evidence that it means “print working directory”, one can find it indirectly in the man page. But I was looking for something concrete and explicit (hence the quotes), and it wasn’t there.

          Anyway, I still think it’s an interesting topic, but I know that not everyone will agree, and that’s more than OK. Thanks!

      2. 2

        (Author here) - I’m sorry you considered the title “click-baity”, that wasn’t my intention at all. Perhaps the use of “myriad” was a little extreme, but I thought having at least 4 potential meanings for such a “lowly” command as pwd warranted at least some adjective, and I decided to allow myself some breadth in expression.

    5. [Comment removed by author]

      1. [Comment removed by author]