Did early Unix shells ever use `chd` command to change directories?

3 damiaozi 1 7/14/2025, 5:38:36 AM
I've been exploring early Unix systems, particularly *Unix V0 on the PDP-7* and its successor, *Unix V1 on the PDP-11*, using the SIMH emulator.

Interestingly, one of the most common modern shell commands, `cd`, did *not* exist in these early versions.

- In *Unix V0*, directory changes were done via a shell command called `ch`, used in combination with a special directory called `dd`(directory directory). For example, to enter Ken's home directory, one would type `ch dd ken`. This seems to reflect that a full hierarchical file structure hadn't been implemented yet. I've verified this behavior in the SIMH emulator.

- In *Unix V1*, the method becomes more familiar: you use `chdir /usr/ken`, though still *not* `cd`. This is also verified on SIMH. Dennis Ritchie mentioned in _"The Evolution of the Unix Time-sharing System"_:

> "Incidentally, _chdir_ was spelled _ch_; why this was expanded when we went to the PDP-11 I don't remember."

Now here's where it gets curious:

While reading the [Unix V0 shell source code (`pbsh.s`)](https://github.com/DoctorWkt/pdp7-unix/blob/master/src/other/pbsh.s#L199C1-L210C18), I found something that seems to check for a built-in command matching the string `"chdir"` — but compares the first 3 characters, NOT 2 or 5:

```asm " https://github.com/DoctorWkt/pdp7-unix/blob/master/src/other/pbsh.s#L199C1-L210C18

chdirstr: <ch>;<di>;<r 040

. . . . . .

" check for built-in "chdir" command lac argv0 sad chdirstr skp jmp 1f lac argv0+1 sad chdirstr+1 skp jmp 1f lac argv0+2 sad chdirstr+2 jmp changedir ```

This logic suggests it would match a string like `chd` — since only the first 3 characters are compared (`argv0`, `argv0+1`, `argv0+2`).

However, when running the Unix V0 in SIMH, I can only get `ch` to work — `chd` doesn't appear to be recognized as a command. This seems contradictory with what the shell source implies.

Has anyone seen `chd` documented or working in early Unix shells?

Would love to hear from others who have explored this layer of Unix archaeology.

Comments (1)

GianFabien · 1h ago
I vaguely recollect that in Unix v5 as distributed to universities by Western Electric in 1976, there was a chdir command. Which if only the first 3 chars were compared would have been like chd. But that's almost a half a century ago ... memories do get corrupted, e.g. by CP/M.