Classic Computer Magazine Archive START VOL. 4 NO. 5 / DECEMBER 1989

A Small Tour of UNIX - Part 1

First shown publicly in Dusseldorf in August 1989, Atari's new TT features some pretty hot hardware: a 16-MHz 68030 that runs about four times faster than an ST; higher resolution displays; lots of serial ports; works with lots of ST GEM programs. . . and UNIX compatibility. Wait, you say-UNIX? If you've read about UNIX, but never done much with it, let Dave Small take you on a tour of UNIX. In Part I, Dave covers basic UNIX system organization.

I wonder what UNIX is all about? I wonder what it's like? A year or so ago I asked myself the same questions and ended up with a small UNIX machine to learn on. At this point, I'm reasonably UNIX literate. I can walk around inside a UNIX system and actually use it. I'm no UNIX guru, but that's good-because articles written by gurus invariably lose a beginner's perspective.

GEM and UNIX come at the same tasks from different directions.

I thought I'd tell you what I understand about UNIX and take you for a walk though UNIX. I'll orientate the discussion towards the ST, use ST-based examples wherever I can and try to stay away from guru-ese. I'll keep it as informal as possible.

On the ST, you do one thing at a time. Only one user does it at a time, too. UNIX is totally different.

UNIX completely predates microcomputers; there wasn't even a 68000 when UNIX was first designed! Hence, UNIX is designed for those BIG computers-the ones that many terminals are connected to and many people are doing work on, all at the same time.

Thus, on a typical small UNIX system, you can plug in, say, five users-"Multi-User"- and they can each be working at the same time- "Multi-Tasking". Each user "thinks" he has the machine to himself; the machine time-shares between users. (Cold Reality: The more users on a machine, the more it slows down.)

It's hard to find a generally known analogy for ST users for all this. Dave Beckemever's MT C-Shell for the ST is a very good UNIX "workalike" for the ST user. With it, I can plug a terminal or another ST into an ST running MT C-shell and be doing things (say, writing a BASIC program) on my terminal while another user, on the ST's keyboard, is doing something else (say writing a letter in WordPerfect).

In UNIX, typically, each user plugs in through a serial port. It's a good thing the TT has four of them for
multiple terminals to be added in. The ST only has one. (On expensive UNIX boxes, they sometimes use high speed links, such as Ethernet to hook UNIX boxes to UNIX boxes and to other users; the TT has Ethernet, too.)

User Names and Directories
Of course, this multi-user stuff implies that each user has a name, so that the system can keep the users straight. So on a typical UNIX system, you have to "log in" to start a UNIX work session. Therefore, instead of just turning on your ST and getting going, you'd turn on the TT with UNIX and "log in" under a user name with your password. I use "dsmall" on my UNIX box.

The only good ST analogy for this is on a bulletin board or big network such as CompuServe or GEnie, where you have a user number/name and password, a separate place for your email and sometimes for your files. The ST itself assumes it only has one user and thus never asks your name-and why should you need a password, anyway?

Since a UNIX system has multiple users, each one needs his own place to store files; otherwise, everyone's files would get mixed together. UNIX uses subdirectories (folders to us ST people) to handle separate filing areas. There can be subdirectories within subdirectories (folders within folders), just as with the ST and the way you name a file within a folder (the path-name) is remarkably like the ST.

Let's say we have a UNIX .system with three users on it. We would have a place to keep users (a folder named "usr") and three sub-folders in it, called, say, "dsmall", "dwheeler" and "heidi". I'd keep my files in "/usr/dsmall", Doug's files would be in "/usr/dwheeler" and Heidi's files in "/usr/heidi' This is called your "home'' directory; if you type "cd" (change directory), you come back to here. On the ST, it would be "C:\usr\dsmall", "C:\usr\dwheeler" and "C:\usr\heidi". See Figure 1.

Note the difference in forward and back-slashes! This is one difference that is guaranteed to drive you nuts; UNIX uses forward slashes, while GEM uses backslashes. Switching back and forth from GEM to UNIX is not pleasant!

Drive Letters vs. Subdirectories
Also note there are no drive letters in UNIX. On the ST, we have A: and B: for floppies, and C: through P: for hard disks and RAM disks, in other words, we have multiple root directories, each on a separate disk drive. Your hard disk "root" or lowest directory on C: IS "C:\"; that's displayed whenever you first open the "C:" folder.

In ST terms, think of UNIX as only having one disk drive with the drive letter, say, C: for the hard disk, just being assumed. You can assume the hard disk part; UNIX is so huge that a hard disk is simply required.

The UNIX "root" directory is similarly named, "/" (remember, forget the drive letters; there's only one drive). All folders are built up from that one root directory, as though your ST only had one hard disk name, but no 16-megabyte limit on partitions. There's no limit on UNIX directory size.

But there's still no UNIX drive letters. So how do they handle "removable storage "like floppies?

UNIX was designed before 3 1/2-inch floppy disks! So floppy support was added later. The closest analogy to a floppy disk the designers could think of was a "removable disk pack," like the big 500-megabyte units on mainframes. Thus, to access a floppy, you have to insert the floppy disk, type in a UNIX command called MOUNT (just like operators MOUNT a disk pack), and when you're done, you have to de-MOUNT the "disk pack" floppy. (Sheesh!)

Each user "thinks" he has the machine to himself.

When you MOUNT a floppy disk, you attach it to a subdirectory or folder. For example, let's say you have a folder called "\floppya" When you request a directory on it normally, it's empty Ah, but when you MOUNT a floppy, suddenly that floppy's data is available inside of the "/floppy" folder. In an ST, this would be just as if floppy A:'s data showed up inside of a "C:\floppy" folder whenever you put a disk in A:! And, of course, when you de-MOUNT "/floppya" from its floppy, it reads empty again.

So you see, GEM and UNIX come at the same tasks from different directions. In GEM, there are multiple directories, each one based on a different drive In UNIX, there is only one main directory with different drives showing up as subdirectories, along with the "normal" other subdirectories on the main drive.

ST vs. UNIX PathNames
Drive A:\
Drive B:\
Drive C:\AUTO\STUFF\BASIC (misc. folders)

/ (the root)
(misc. folders)
/FLOPPYA Becomes contents of floppy A if A is MOUNTed
/FLOPPYB Becomes contents of floppy B if B is MOUNTed
Dave's files
Doug's Files
Heidi's Files

Unlike the ST's GEM file management system, UNIX requires a more extensive system
to manage and separate multiple users on a single system. The worst part of moving from
one system to another is that UNIX uses a slash (I) where GEM uses a backslash (\)-a
difference guaranteed to drive you crazy!

Owners and Permissions
Since there are named users with their own files, suddenly there are owners of files. Each person has exclusive rights to their files. Each file has permissions and an owner. You, as file owner, can select whether only you, your "group" (presumably, an immediate group of people with whom you work on a project) or anyone on the UNIX system can use your file. And that means either to execute it if it's a program, read it if it's data or write to it (and possibly destroy it). There's nothing like this on the ST, short of some custom password-protection program for a file, say, using ARC's encryption option.

Hence, unless Doug specifically lets me look at his files by granting me permission, I can't use them. And vice versa.

Again, the only analogy in the ST world is on a multi-user BBS or large network; other people can't read your private mail, unless you specifically let them.

Next Issue
That's enough for the first few steps on our UNIX tour. In the next issue, I'll introduce you to the guru named root and show you some of the uglier sights in UNIX.

Contributing Editor Dave Small is one of a small circle of ST pioneers who have helped to make the ST popular. Dave has been a leader in the development of ST Macintosh emulators, culminating with the release of his latest triumph, Spectre GCR.