9

What is the etymology of $PWD? Is it an acronym?

I know there is a command pwd which prints working directory, but to my mind, it would have made more sense to name the variable $CWD for Current Working Directory, since shell variables contain data, rather than print them.

15
  • 12
    "The PWD shell variable was introduced by ksh88, where it was described as the present working directory." en.wikipedia.org/wiki/Pwd
    – jasonwryan
    Oct 19, 2017 at 2:15
  • 6
    @jasonwryan, that looks like an answer.
    – Wildcard
    Oct 19, 2017 at 2:27
  • 1
    The SunOS 5.5.1 ksh manpage dated 1995 uses "present working directory", but the OpenBSD 2.0 ksh manpage (also dated 1995) uses "current working directory"... both were released in late 1996. Interesting.
    – muru
    Oct 19, 2017 at 2:28
  • 4
    FWIW, the command pwd is described as “print working directory pathname” in Thompson&Ritchie's UNIX Programmer's manual 5th edition, dated June 1974. And it's not in the 3rd edition. Alas, I cannot find a copy of 4th.
    – spectras
    Oct 19, 2017 at 3:20
  • 2
    pwd the utility and the pwd data structure field come from MULTICS. I believe PWD the environment variable was added on UNIX. It certainly predates ksh88 though. Oct 19, 2017 at 8:03

1 Answer 1

4

It Is an acronym. The acronym is:
Print Working Directory

edit
Historically, program output was printed on paper rather than on screens. So the print part is due to the output technology of the time that the command was developed.

3
  • And the etymology? What is the source for you assertion?
    – Tom Hale
    Nov 3, 2017 at 8:48
  • However @Sato has a good point, as a guide to multics written in 1980 shows the use of pwd as Print Working Directory multicians.org/multics-commands.html and this book agrees books.google.com/…
    – Shōgun8
    Nov 3, 2017 at 14:49
  • And this may be the most telling yet: before Multics existed there was CTSS (both from MIT) and its output was printed on paper cards instead of Cathode Ray Tubes. So Print was the appropriate term of the day. linfo.org/pwd.html
    – Shōgun8
    Nov 3, 2017 at 15:27

You must log in to answer this question.

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