maux
Star on GitHub Buy me a coffee

L0. Find your way around

Learn / L0

Goal: learn where things are, with five commands (pwd, cd, ls, head, wc) you will use in every later lesson. No files to write.

What you need

A booted maux with the release disk, at the $ prompt. Nothing from an earlier lesson.

The session

Every line after a $ was typed, a key at a time, by the gate check-examples, on the machine, and the lines under it are what the screen showed. The dates in this ladder's ls -l listings read - because the test machine has its clock card switched off.

$ pwd
/mnt/MAUX/
$ ls
BIN            DEMO           LSEG           PLRT           TMP
BYERES         ETC            MAUX.SYSTEM    PRODOS         USR
DELTEN.SYSTEM  KSEG           PLLIB          TENANT.SYSTEM
$ cd /
$ pwd
/
$ ls
bin  dev  etc  mnt  tmp  usr
$ ls /mnt
MAUX
$ ls /dev
null   s7d1   tty    tty1   tty2   tty3   tty4   ttya0
$ cd /usr/man
$ pwd
/usr/MAN/
$ ls | head -3
ADMIN
AR
AS
$ head -1 ECHO
ECHO(1)              General Commands Manual             ECHO(1)
$ ls /bin | wc -l
92

What just happened

/ is not a directory on any disk. It is a small table the kernel owns, with bin, dev, etc, mnt, tmp and usr in it. The disk's own volume, named MAUX, is mapped under /mnt, and /bin, /etc, /tmp and /usr are that volume's BIN, ETC, TMP and USR directories. That is why a freshly booted shell starts in /mnt/MAUX/ and why ls there shows the same directories you reach through /.

/dev holds the devices: null, the terminals tty to tty4, the serial port ttya0 and the disk s7d1. They are listed like files because to a program they are files: cat, redirection and pipes treat them the same way.

Names are ProDOS names underneath, so a directory made by the disk builder is stored upper case (pwd printed /usr/MAN/ for /usr/man), while a file you create keeps the case you typed. The two refer to the same thing: ProDOS ignores case when it looks a name up.

/usr/man holds the manual, one file per page, as formatted nroff output: plain text with overstrikes, which the console draws as emphasis. head -1 ECHO shows the first line of the page for echo; man echo shows the whole page through more, a screenful at a time (q quits). The session uses pwd, cd, ls, head and wc; the last of them counts lines, and the pipe in ls /bin | wc -l sends one program's output to another's input. That is the idea the rest of the ladder builds on. The number it prints is the number of programs on the disk.

Try next

Find out how many pages the manual has (ls /usr/man | wc -l), then read the page for ls with man ls. Which flag lists a file's ProDOS type?

All lessons | Hello, world in the shell →