UNIX: Is It For You? Part I: For The User

Copyright 1991 Daniel J. Barrett. This article originally appeared in .INFO Magazine, October 1991. This article is freely distributable as long as it is not modified.

Commodore has released several Amiga computers that run an industry-standard, multitasking operating system called UNIX. What does UNIX have to offer the average Amiga owner, game player, power user, or programmer? How is UNIX different from the Amiga operating system (AmigaOS) that we get for free? Is UNIX "better"?

This is a series of two articles comparing and contrasting UNIX and AmigaOS. This month, we discuss these two operating systems from the point of view of an ordinary user. Part two will focus on topics for power users and programmers. These articles should serve as a quick introduction to the world of UNIX.

THE COMPONENTS OF UNIX

AmigaOS consists of two parts: a low-level program called Kickstart, plus a set of support programs and files found on the Workbench disk. UNIX also has this dual structure, but it is much larger. Its low-level "kernel" program could fit on 1-2 floppy disks, but the support programs and files can easily fill up 80 megabytes, so a hard disk is obviously needed!

So what do you get? HUNDREDS of programs: text editors, spelling checkers, document processing software, over a dozen compilers and interpreters, programming tools, programs for sorting and searching data, on-line documentation, networking software, electronic mail, window systems, games, tape backup programs, three or four user interfaces (shells), and day-to-day programs similar to your Amiga CLI commands. And if that's not enough, thousands of freely-distributable UNIX programs are available.

USER INTERFACES

On a standard Amiga, we can use graphical (Workbench) and command line (CLI) interfaces. UNIX has a command-line interface called the "shell", and many of today's UNIX workstations offer a window environment such as the "X" window system. Currently, there is no "standard" UNIX graphic interface, although "X" is probably the most popular.

UNIX GUI's tend to be more complicated and configurable than the Amiga Workbench. "X" allows a user to specify exactly what happens whenever the user presses any key or clicks the mouse anywhere on the screen. For example, you could easily design your own menu (both its look and its function) and cause it to pop up whenever you press the right mouse button or the F6 function key. This power comes with a price, though: "X" is a large and compute-intensive application, whereas Workbench is small and relatively speedy.

Now, let's compare and contrast the Amiga CLI and the UNIX shell. At first glance, they appear quite similar: they both have wildcards, script languages, command history, command-line editing, and so on. However, they have several important differences. The main one concerns the treatment of wildcard characters. Suppose you want to see your Amiga files whose names begin with 'A', so you type the CLI command

		list A#?
What happens now? In the Amiga CLI, wildcards are seen and interpreted by individual programs. This means that "list" itself must have the built-in ability to understand the "#?" characters; the CLI does not interpret them. In short, Amiga programs understand wildcards only if they are specifically written to do so.

In UNIX, wildcards are interpreted by the shell, not the programs. Here is a UNIX command like the AmigaOS command above:

		ls A*
The wildcard is interpreted by the shell before "ls" executes, becoming (let's say)
		ls Aardvark Amiga Anniversary.txt
Finally, "ls" executes as if you had typed the 3 arguments yourself. Thanks to the shell, every UNIX program automatically "understands" wildcards.

Here are some other shell/CLI differences:

  • The user can easily send the output of one program as input to a second program, simply by typing a vertical bar ('|') between the two programs on the command line. For example, to view your file names one page at a time, you might send a directory listing as the input to the "more" program, like this:
    			ls | more
    
    These "pipelines" are also possible in the CLI, but the syntax is not as convenient.
  • UNIX programs may be paused, restarted, pushed into the background, or brought into the foreground anytime. This is actually a feature of the operating system and not the shell, but it is the shell that gives the user access to this "job control" ability.
  • It is not permissible to type CLI script commands directly at the command line. Have you every tried typing an IF statement directly at the CLI prompt? You get an error message:
    			1> if EXISTS MyFile
    			IF only valid within command files
    
    However, the UNIX shell allows you to type script commands directly at the command line. In general, the shell's script language is more powerful and general than the CLI's. (Note that AmigaOS 2.0 makes vast improvements to the CLI, though.)
  • Suppose you execute a CLI script that changes its directory using the "cd" command. When the script is finished, your original CLI will have "moved" to that new directory. This can surprise you if you didn't know that the script contained a "cd" command.

    Under UNIX, every shell script executes in its own private "environment". Therefore, your scripts are free to "cd" all over the place and still have no effect on your original shell when they terminate.

  • There are several "shell" programs in the Amiga public domain that give the Amiga user many of the UNIX capabilities mentioned above. Some popular ones include Matt Dillon's "csh" and Steve Koren's "sksh".

    FILE PROTECTION

    Have you ever let a friend use your Amiga, only to find that he/she accidentally modified some of your files? This unfortunate experience is possible because AmigaOS does not prevent one user from affecting another user's files. In fact, AmigaOS does not have any concept of file "ownership" at all -- any file is accessible to any user.

    On the other hand, UNIX was built to be a multi-user environment. Every file has an owner, and only the owner can modify it. This protection is enforced by UNIX, and there is no way around it (unless there is a bug in the operating system!). Of course, the owner can choose to share files with other users on the machine.

    How do you identify yourself as the owner of your files? Simple: when you first sit down to use the computer, you type in your name (really, a designated "login name") and a secret password you have chosen previously. If you type the password correctly, then UNIX treats you as that user until you end the computing session ("log out").

    There is one special user on every UNIX machine called the Superuser, or "root". The Superuser may access every file on the machine without restriction. Important system files are typically owned by the Superuser, so they cannot accidentally be deleted by casual users. Have you ever deleted your only copy of Deluxe Paint by mistake? UNIX guards against this error.

    As you might imagine, the Superuser's password is almost always a closely-guarded secret. If you are the owner and only user of a UNIX Amiga, however, it is likely that you will be your machine's Superuser and have access to all files. Even so, it is wise for you to create and use a separate, "ordinary" login name. When you are the Superuser, you lose the extra protection UNIX gives you, and it is once again possible to delete system files accidentally.

    MULTI-USER ENVIRONMENT

    A major feature of UNIX, and many other mainframe operating systems, is that many users can use the computer at the same time. Each user requires a separate terminal which can be attached to the serial ports of a UNIX Amiga.

    When a UNIX user "logs in", a private file similar to the Amiga's S:Startup-Sequence is executed. This allows each user to configure his/her UNIX environment differently from every other user's, even on the same machine. For example, one user's startup file might print a friendly HELLO message, while another's might automatically open four shell windows.

    Having multiple users on the same machine opens the door for on-line communication. Electronic mail allows files and letters to be sent between users, and the programs "write" and "talk" allow users to carry on interactive conversations.

    DO I NEED UNIX?

    Is UNIX "better" than AmigaOS for the average user? The answer depends on your needs and your personality. If you use your Amiga primarily for playing games, then UNIX has little or nothing new to offer you. UNIX games, while fun, do not begin to approach the level of graphics and fast action found in a typical Amiga game.

    If you use your Amiga for its strengths in graphics and video, then there probably isn't much reason to move to UNIX right now. Similarly, if you primarily use "canned" Amiga application programs, and you are happy with them, then you may not need UNIX at the moment.

    If you are a programmer, however, you should give UNIX VERY serious consideration. I'll talk more about this next time.

    SUGGESTED READING

    There are dozens of UNIX books on the market, and it's difficult to know which ones to read. My general rule of thumb for new users is to buy a book written fewer than 5 years ago. A number of things about UNIX have changed during that time, and these differences can be very confusing for beginners.

    Here are some of my favorite UNIX books. For a very quick introduction, try "Learning The UNIX Operating System" by Grace Todino and John Strang (O'Reilly & Associates, Inc., 1987). For a solid tutorial and reference, try "A Practical Guide to the UNIX System" by Mark G. Sobell (Benjamin-Cummings, 1989). Once you have been exposed to UNIX, check out "Life With UNIX" by Don Libes and Sandy Ressler (Prentice-Hall, 1989). Interesting, well-written and funny, this book traces the history of UNIX and offers a lot of good (and hard-to-get) advice.

    About The Author

    Daniel Barrett is a long-time Amiga user and UNIX systems administrator. You are welcome to contact him by e-mail:
    	INTERNET:	barrett@cs.umass.edu
    	COMPUSERVE:	>internet:barrett@cs.umass.edu
    

    - barrett@cs.umass.edu