Try it

Boot Unix V6 from the Time Machine on my home page, or in its own tab at research.swtch.com/v6.

Handy keys

DEL stops a running program (on a Mac, fn + Delete)
# erases one character, @ throws away the line (the emulator also accepts Backspace and Ctrl‑U)
Ctrl‑D ends input; at the prompt it logs you out
and it's chdir, not cd

A field guide to Unix V6

Unix V6 is the 1975 Unix from Bell Labs, the one on the museum card. The emulator is Russ Cox's: the real V6 system running on a simulated PDP-11, in your browser, with a few terminals side by side. Everything below really works; I checked the disk. Here are seven little adventures, in fifteen minutes or so.

Tip: V6 is from the age of printing terminals, so it's terse. When something works, it usually says nothing at all. No news is good news.

★★★★★★★★★★★★

1. Log in as Ken

The accounts on this disk are the real ones from Bell Labs. Log in as ken (Ken Thompson, who created Unix) or dmr (Dennis Ritchie, who created C). The password is the same as the user name.

login: ken
Password: ken
%

That % sign is the whole welcome. You're in Ken's home directory, /usr/ken.

2. Look around 1975

% ls
% ls /bin
% who
% date
% cal 10 1975

who shows everyone logged in; each browser terminal on the page is its own teletype. cal 10 1975 prints the calendar for the month V6 shipped. To move around, use chdir /usr (the name cd hadn't been invented yet), and ls to see what's there.

3. Hello, world, the 1975 way

There are no full-screen editors here. The editor, ed, works one line at a time. Type a to append lines, a lone . to stop, w to write the file, q to quit.

% ed hello.c
?
a
main()
{
	printf("hello, world\n");
}
.
w
41
q
% cc hello.c
% a.out
hello, world

The question mark is ed's only error message (here it just means "new file"), and the 41 after w is how many characters it wrote. The compiler names its result a.out, and you run it by typing a.out, with no ./ in front. This is three years before the book that made "hello, world" famous, and you just wrote it on the system its authors used.

4. Find the famous comment

The entire V6 kernel source is on the disk, including swtch, the routine that switches the processor between processes. It holds the most famous comment in software:

% grep expected /usr/sys/ken/slp.c
 * You are not expected to understand this.

To read it in place, print the whole file with cat /usr/sys/ken/slp.c and scroll. Dennis Ritchie later explained the line meant "this won't be on the exam," not "we're smarter than you," and the code it guarded really did have a subtle bug.

5. Play chess against Ken Thompson's program

The games live in /usr/games, which isn't in your path, so type the full name:

% /usr/games/chess
p-k4
e2e4 e7e5

Moves work in either old descriptive notation (p-k4) or algebraic (e2e4). An empty line prints the board, first makes the computer play white, and if you type something it can't parse it says, in full, "eh?". Its manual warns: "Over-use of this program will cause it to go away." Press DEL to resign.

Also in the drawer: /usr/games/wump (Hunt the Wumpus!), bj (blackjack), ttt (tic-tac-toe), moo (a number-guessing game) and cubic (3D tic-tac-toe).

6. Chat between terminals

The emulator page gives you several terminals, and V6 was built for people sharing one machine. The tty0 to tty8 buttons under the screen switch between them. Log in as ken on tty0, click tty1 and log in as dmr there, then click back to tty0 and:

% write dmr
hi dennis, nice operating system

Every line you type lands on dmr's terminal: click tty1 to see it arrive. Answer from there with write ken. That's instant messaging in 1975. End your side with Ctrl‑D. (Etiquette of the day: type o for "over" and oo for "over and out.")

7. Odds and ends

% dc
2 100^p
1267650600228229401496703205376
q
% banner hooray
% echo hello | wc

dc is an arbitrary-precision calculator. You push numbers, ^ raises to a power and p prints, so that's 2100, computed exactly on a simulated 16-bit computer. (Its friendlier cousin bc crashes this emulator, so stick with dc.) banner prints giant letters, made for line printers. The | is the pipe, which was brand new then: it feeds one program's output into the next.

For more, the emulator page has its own notes, John Lions' famous commentary walks through the whole kernel, and the original manuals are at the Unix Heritage Society.