Unix V4 Software Catalog
Table of Contents
- System Information
- Filesystem Layout
- /bin - Core Utilities (49 commands)
- /usr/bin - User Utilities (~40 commands)
- /usr/games - Entertainment (7 programs)
- /lib - System Libraries
- /usr/sys - Kernel Source
- /usr/c - C Compiler Source
- /etc - System Configuration
- /dev - Devices
- System Calls (41 total)
- Statistics Summary
- Historical Notes
- References
System Information
# There is no uname in Unix V4 - it was introduced in Unix V7 (1979)
# System identification must be done manually:
# cat /usr/sys/ken/main.c | head -5
/*
* Copyright 1973 Bell Telephone Laboratories Inc
*/
# Memory and process info:
# ps
PID TTY TIME CMD
1 0:03 /etc/init
13 8 0:00 -
14 8 0:00 ps
Filesystem Layout
/ Root filesystem
├── bin/ Core utilities (49 commands)
├── dev/ Device files
├── etc/ System configuration
├── lib/ Libraries (libc, assembler)
├── mnt/ Mount point
├── tmp/ Temporary files
├── unix Kernel binary
└── usr/ User programs and source
├── bin/ Additional utilities (~40 commands)
├── c/ C compiler source
├── games/ Entertainment (7 games)
├── lib/ User libraries
├── source/ System source
└── sys/ Kernel source
├── ken/ Ken Thompson's code
└── dmr/ Dennis Ritchie's code
/bin - Core Utilities (49 commands)
| Command | Size | Description |
|---|---|---|
| ar | 2,058 | Archive maintainer (create/modify .a files) |
| as | 21,334 | PDP-11 assembler |
| bas | 7,074 | BASIC interpreter |
| cat | 330 | Concatenate and print files |
| cc | 4,302 | C compiler driver |
| cdb | 3,928 | C debugger |
| check | 1,454 | Filesystem consistency check |
| chmod | 666 | Change file mode |
| chown | 468 | Change file owner |
| clri | 330 | Clear inode |
| cmp | 502 | Compare two files |
| cp | 546 | Copy files |
| date | 1,164 | Print or set date/time |
| db | 5,018 | Debugger |
| dc | 3,430 | Desk calculator (arbitrary precision) |
| dd | 1,730 | Convert and copy files |
| df | 656 | Disk free space |
| dsw | 628 | Delete interactively |
| du | 822 | Disk usage summary |
| dump | 2,816 | Filesystem backup |
| echo | 216 | Echo arguments |
| ed | 6,854 | Line editor |
| exit | 72 | Exit shell |
| fc | 1,214 | Fortran compiler (front end) |
| goto | 422 | Shell goto for scripts |
| if | 694 | Conditional command |
| kill | 302 | Send signal to process |
| ld | 6,194 | Link editor (linker) |
| ln | 324 | Make links |
| login | 1,076 | Login program |
| lpr | 1,052 | Line printer spooler |
| ls | 1,506 | List directory contents |
| 2,406 | Send/receive mail | |
| mkdir | 226 | Make directory |
| mv | 786 | Move files |
| nm | 1,430 | Print symbol table |
| od | 1,066 | Octal dump |
| pr | 1,876 | Print files with pagination |
| ps | 2,150 | Process status |
| restor | 2,528 | Restore from dump |
| rew | 208 | Rewind tape |
| rm | 600 | Remove files |
| rmdir | 194 | Remove directory |
| sh | 6,314 | Bourne shell (Thompson shell) |
| size | 608 | Print section sizes of binary |
| sort | 4,006 | Sort lines |
| strip | 866 | Remove symbol table |
| stty | 890 | Set terminal options |
| su | 500 | Substitute user (become root) |
| sum | 330 | Checksum a file |
| sync | 98 | Flush filesystem buffers |
| time | 340 | Time a command |
| tp | 3,668 | Tape manipulator (tar ancestor) |
| tty | 194 | Print terminal name |
| uniq | 874 | Report repeated lines |
| who | 604 | Who is logged in |
| write | 1,000 | Write to another user |
Command Categories
Text Processing
cat- display filescmp- compare filesecho- echo texted- line editor (THE editor of Unix)pr- paginate for printingsort- sort linesuniq- unique lines
File Management
cp- copyln- linkls- listmkdir- make directorymv- move/renamerm- removermdir- remove directory
Development Tools
ar- archive maintaineras- assemblercc- C compilercdb- C debuggerdb- debuggerfc- Fortran compilerld- linkernm- symbol tablesize- section sizesstrip- remove symbols
System Administration
check- filesystem checkchmod- change modechown- change ownerclri- clear inodedf- disk freedu- disk usagedump- backuprestor- restoresync- flush buffers
Process Control
kill- send signalps- process statustime- time command
Communication
mail- electronic mailwho- users logged inwrite- send message
Other
bas- BASIC interpreterdate- date/timedc- desk calculatordd- convert/copylogin- loginsh- shellsu- substitute user
/usr/bin - User Utilities (~40 commands)
| Command | Description |
|---|---|
| adb | Advanced debugger |
| arcv | Archive converter |
| bc | Calculator language (uses dc) |
| col | Filter reverse line-feeds |
| comm | Common lines in sorted files |
| cref | Cross reference |
| diff | File differences |
| file | Determine file type |
| find | Find files |
| grep | Search for patterns |
| lex | Lexical analyzer generator |
| look | Find lines in sorted file |
| mesg | Permit/deny messages |
| nroff | Text formatter |
| passwd | Change password |
| pfe | Print floating exception |
| prof | Execution profiler |
| ptx | Permuted index |
| rev | Reverse lines |
| roff | Text formatter |
| sa | Shell accounting |
| salloc | String allocation |
| speak | Word pronunciation |
| split | Split files |
| su | Substitute user |
| sum | Checksum |
| tabs | Set terminal tabs |
| tc | TROFF typesetter interface |
| tr | Translate characters |
| troff | Typeset formatter |
| typo | Find typos |
| wc | Word count |
| yacc | Parser generator (Yet Another Compiler Compiler) |
Notable Utilities
grep - Global Regular Expression Print
First appearance of the legendary pattern matcher:
# grep 'main' /usr/sys/ken/*.c main.c:main()
yacc - Parser Generator
Stephen C. Johnson's compiler-compiler, still used today:
# ls /usr/lib/yaccpar /usr/lib/yaccpar
diff - File Comparison
Douglas McIlroy's diff algorithm:
# diff file1 file2 3c3 < old line --- > new line
/usr/games - Entertainment (7 programs)
| Game | Size | Description |
|---|---|---|
| bj | 1,562 | Blackjack card game |
| chess | 14,310 | Chess with opening book |
| cubic | 2,468 | 4x4x4 3D tic-tac-toe |
| moo | 624 | Bulls and Cows (Mastermind precursor) |
| ttt | 2,192 | Tic-tac-toe with learning AI |
| ttt.k | 268 | TTT knowledge/learning file |
| wump | 5,386 | Hunt the Wumpus (cave adventure) |
See Unix V4 Games for detailed analysis.
/lib - System Libraries
| File | Size | Description |
|---|---|---|
| libc.a | 12,856 | C runtime library |
| liba.a | 2,460 | Assembler library |
| crt0.o | 116 | C runtime startup |
| fr0.o | 224 | Floating-point runtime |
| filib.a | 2,174 | Floating-point library |
| libf.a | 9,792 | Fortran library |
libc.a Contents
Core C library functions (partial list):
# ar t /lib/libc.a crt0.o - C runtime startup alloc.o - memory allocation atof.o - ASCII to float atoi.o - ASCII to integer ecvt.o - float conversion fltpr.o - float print getc.o - get character getchar.o - get char from stdin ldiv.o - long division ltod.o - long to double printf.o - formatted print putc.o - put character putchar.o - put char to stdout qsort.o - quicksort setjmp.o - non-local goto
/usr/sys - Kernel Source
/usr/sys/ken - Ken Thompson's Code
| File | Lines | Description |
|---|---|---|
| main.c | 217 | Kernel initialization |
| slp.c | 239 | Sleep/wakeup mechanism |
| prf.c | 131 | printf for kernel |
| trap.c | 157 | Trap/interrupt handling |
| sig.c | 131 | Signal handling |
| sys1.c | 235 | System calls (exec, exit, wait, fork) |
| sys2.c | 238 | System calls (read, write, open, close) |
| sys3.c | 192 | System calls (stat, chmod, chown) |
| sys4.c | 147 | System calls (time, stime, getuid) |
| sysent.c | 76 | System call table |
| clock.c | 78 | Clock interrupt handler |
| fio.c | 121 | File I/O primitives |
| iget.c | 152 | Inode management |
| alloc.c | 155 | Block allocation |
| nami.c | 131 | Pathname resolution |
| pipe.c | 95 | Pipe implementation |
| rdwri.c | 100 | Read/write implementation |
| subr.c | 145 | Subroutines |
| text.c | 126 | Text segment management |
/usr/sys/dmr - Dennis Ritchie's Code
| File | Lines | Description |
|---|---|---|
| bio.c | 265 | Block I/O system |
| tty.c | 448 | Terminal driver |
| kl.c | 78 | KL11 console driver |
| pc.c | 103 | PC11 paper tape driver |
| lp.c | 76 | LP11 line printer driver |
| rk.c | 98 | RK05 disk driver |
| rf.c | 81 | RF11 fixed-head disk driver |
| tc.c | 111 | TC11 DECtape driver |
| tm.c | 130 | TM11 tape drive driver |
| dc.c | 95 | DC11 communications driver |
| dh.c | 186 | DH11 multiplexer driver |
| dn.c | 60 | DN11 autodialer driver |
| dp.c | 168 | DP11 driver |
| mem.c | 56 | Memory device (/dev/mem) |
| partab.c | 16 | Parity table |
| cat.c | 56 | Phototypesetter driver |
| vs.c | 63 | Voice synthesizer driver |
/usr/c - C Compiler Source
| File | Description |
|---|---|
| c00.c | Compiler pass 0 - lexer |
| c01.c | Compiler pass 0 - parser |
| c02.c | Compiler pass 0 - declarations |
| c03.c | Compiler pass 0 - expressions |
| c04.c | Compiler pass 0 - output |
| c10.c | Compiler pass 1 - code generation |
| c11.c | Compiler pass 1 - expressions |
| c12.c | Compiler pass 1 - statements |
| c13.c | Compiler pass 1 - optimizer |
| c20.c | Compiler pass 2 - peephole optimizer |
| c21.c | Compiler pass 2 - final output |
| cvopt.c | Optimizer tables |
| table.s | Instruction tables (assembler) |
The compiler runs in multiple passes to fit in limited memory.
/etc - System Configuration
| File | Description |
|---|---|
| init | Init process (PID 1) |
| getty | Terminal line setup |
| glob | Filename expansion (/etc/glob pattern) |
| msh | Mini shell for single-user mode |
| passwd | User database |
| rc | Startup script |
| ttys | Terminal configuration |
| mtab | Mounted filesystems |
/etc/passwd Format
root::0:1::/: bin::3:1::/bin:
Fields: name:password:uid:gid:gecos:home:shell
Note: Empty password field means no password required!
/dev - Devices
| Device | Description |
|---|---|
| rk0 | RK05 disk, raw |
| rrk0 | RK05 disk, block |
| tty0-8 | Terminals |
| mem | Physical memory |
| kmem | Kernel memory |
| null | Null device |
| mt0 | Magnetic tape |
| lp | Line printer |
System Calls (41 total)
| # | Name | Description |
|---|---|---|
| 0 | indir | Indirect system call |
| 1 | exit | Terminate process |
| 2 | fork | Create process |
| 3 | read | Read from file |
| 4 | write | Write to file |
| 5 | open | Open file |
| 6 | close | Close file |
| 7 | wait | Wait for child |
| 8 | creat | Create file |
| 9 | link | Link to file |
| 10 | unlink | Remove file |
| 11 | exec | Execute program |
| 12 | chdir | Change directory |
| 13 | time | Get time |
| 14 | mknod | Make special file |
| 15 | chmod | Change file mode |
| 16 | chown | Change owner |
| 17 | break | Set data segment size |
| 18 | stat | File status |
| 19 | seek | Seek in file |
| 20 | getpid | Get process ID |
| 21 | mount | Mount filesystem |
| 22 | umount | Unmount filesystem |
| 23 | setuid | Set user ID |
| 24 | getuid | Get user ID |
| 25 | stime | Set time |
| 26 | ptrace | Process trace |
| 28 | fstat | File status by descriptor |
| 31 | stty | Set terminal |
| 32 | gtty | Get terminal |
| 34 | nice | Set priority |
| 35 | sleep | Sleep |
| 36 | sync | Sync filesystem |
| 37 | kill | Send signal |
| 38 | switch | Get/set switch register |
| 41 | dup | Duplicate file descriptor |
| 42 | pipe | Create pipe |
| 43 | times | Get process times |
| 44 | prof | Profiling |
| 46 | setgid | Set group ID |
| 47 | getgid | Get group ID |
| 48 | signal | Set signal handler |
Statistics Summary
| Category | Count |
|---|---|
| /bin commands | 49 |
| /usr/bin commands | ~40 |
| /usr/games | 7 |
| System calls | 41 |
| Kernel files | ~35 |
Total: ~100 user commands, plus kernel and libraries.
Historical Notes
What's Missing (added in later versions)
vi- Visual editor (BSD, 1976)awk- Pattern language (V7, 1977)sed- Stream editor (V7, 1974/77)make- Build system (V7, 1977)uname- System identification (V7, 1979)more/less- Pagers (BSD)curses- Screen library (BSD)csh- C shell (BSD, 1978)
What's Already There
Remarkably, Unix V4 already had:
- Complete C development environment
- grep and other text tools
- Pipes and redirection
- Multi-user capability
- Hierarchical filesystem
- Device abstraction
- Process control
All in ~2.5MB of disk space.
References
- Unix V6 Manual Pages (closest available)
- TUHS Archive
- Unix History Repository
