UNIX Usage Guidelines
J.T. Frey, 04/25/2001

This document gives a basic introduction to the UNIX operating system, in particular the Silicon Graphics implementation called IRIX. For the most part, the commands reviewed here will work on any UNIX-based operating system (Linux, BSD, Mac OS X, etc.) This document contains Exercises, some of which are left for the reader to answer; the answers to the questions found in the Exercises can be found at the end of this document.

  (1.1) What is UNIX?
  (1.2) Connecting to the SGI's from Another Computer
  (1.3) Disk Space: Your Home Directory
  (1.4) Getting Help
  (1.5) Working In and Moving Through Directories
  (2.1) Processes: How Work Is Done

What is UNIX?
Developed in the 1970's at Bell Labs, UNIX is a set of programs which controls a computer: an operating sytem (OS). A computer's operating system is in charge of managing all of the hardware: hard drives, memory, monitor, mouse, keyboard, etc. The operating system also provides a user interface: a means by which a person gives the computer commands. UNIX was developed to be a multiuser operating system, since it allows many people to use the computer at once; in other words, several people may be connected to the computer giving it commands simulaneously.

  NOTE: Some of the terms which originated in UNIX-based operating systems which you may hear are:
  • multiuser: OS which allows more than one user to connect, give commands, and store files on a computer
  • multitasking: running more than one task simultaneously by giving each task discrete bits of CPU time
  • multiprocessing: OS which can efficiently use more than one processor inside a single computer

Today, there are many operating systems based upon the original design concepts of UNIX as dictated by Bell Labs: Linux, FreeBSD, OpenBSD, NetBSD, Darwin, Mac OS X, IRIX, HP-UX, AIX, A/UX, to name some. Though each OS is based on UNIX, each does also have its own quirks. The particular "quirks" which we'll discuss in this document pertain to SGI's IRIX implementation of UNIX.
Connecting to the SGI's from Another Computer
Your key to accessing your UNIX account is your username and password. A day or two after you apply for your account you should receive an account information sheet in your department mailbox (undergraduates, your advisor or professor will get yours). Your username is a textual string of characters which the computer uses to identify you; every person who has an account is assigned a username and a group. A UNIX group is a list of users; typically UNIX groups are used to group users with common traits or interests. On the Chemistry Computing Cluster, UNIX groups exist for each professor and several chemistry courses.

To log on to one of the SGI's, you can use your computer's telnet program.
In all telnet programs you must tell your computer what remote computer to connect to. All the SGI's in the Chemistry Computing Cluster are given a name which you can use to reach them; for example, alfred.duch.udel.edu and eugene.duch.udel.edu. So for Windows or UNIX-based computers, you would connect to alfred using the command:

  telnet alfred.duch.udel.edu

Telnet programs with a graphical user interface (like BetterTelnet for the Mac, for instance) will typically allow you to merely type the name of the remote computer. Once connected, you will be prompted to enter your username and password, and after entering both you will be presented with a command line prompt. The command line is where you type the commands which you wish to give to the remote computer; we call it a prompt because the remote computer waits for you to type something -- it is prompting you that you may enter a command. If you had logged in to alfred, the prompt would look like this:

  [alfred 1%]

You are now logged in to the remote computer and ready to issue commands.
Disk Space: Your Home Directory
Every user is given a home directory on a UNIX-based computer. Most people who have used desktop computers running Windows or the Mac OS are used to having the whole hard drive to themselves; since UNIX is a multiuser operating system, though, each user is restricted to having his or her own tiny domain on the hard drive. Your home directory is the starting point for storage of your data, and when you log in you are automatically in your home directory. What is meant by "in your home directory?" Think of the remote computer as a large filing cabinet: in order to look at a document inside a folder in the cabinet you must navigate through the drawers, then through all the folders until you find the right one. When you look inside the folder, you can only see the documents in that folder? In an analogous fashion, when you log in to a UNIX computer you are put in your home directory to start; sort of equivalent to a secretary fetching the folder from the filing cabinet for you. You are said to be "in" that directory because any command you issue is executed relative to the contents of that directory. The directory which you are "in" is called your working directory.

Just as in the filing cabinet example where you always have a larger container in which you are searching -- first the cabinet, then the drawers, then the folders themselves -- directories on a UNIX computer will have a parent container and any number of children containers. It is best to think of this directory structure in terms of one rule: a directory can contain any number of documents and directories. In the next section we will explore how you see what is in your home directory, how to add files and directories to your home directory, and how to change your working directory so that you are "in" a directory other than your home directory.

  TIP: If you are feeling overwhelmed by the shear number of times I said "directory" in this section, try this on for size:

You walk into a room (logging in, I suppose?) and you're standing in front of a huge file cabinet that has drawers sorted alphabetically, and the drawers contain folders with information about every U.S. resident (we're either at the CIA or the IRS, I guess). Somewhere in there is a folder with your name on it; in UNIX terms, that is your home directory. You pull your folder from the cabinet and open it up to take a look (otherwise why would you be at the file cabinet in the first place?). You're now doing work, which in UNIX terms makes this your working directory. However, inside your folder you find a smaller folder, marked "Dental X-Rays" -- since it's inside your folder that makes it a sub-folder, or in UNIX terms, a sub-directory. You open the "Dental X-Rays" folder and begin working through it -- a light bulb should just have gone off for you, since that means the "Dental X-Rays" sub-folder (sub-directory in UNIX terms) is now your working directory! But you hear the door knob turning now, and afraid of who it might be you slip the "Dental X-Rays" folder back into its parent folder (in UNIX terms, the parent directory) and toss the whole thing back into the cabinet. You slam the drawer shut and leave the room (you just logged out!).
Getting Help
One of my favorite computer quotes of all time comes from the movie Wargames which stars Matthew Broderick and Ally Sheedy. When Broderick's character says regarding a computer system, "Let's ask it for help," Sheedy asks "Can you do that?" Broderick's response boils down to this: the more complex a computer operating system, the more help it needs to provide the user.

UNIX is quite complicated, but it includes a rather nice online help system to balance the complexities. These online pages from a hypothetical user's manual are called man pages and are accessed by using the man command:
man [UNIX command]
The way it works is simple: for any UNIX command you can look up a lengthy explanation of all the commands options and uses by prefixing the command with "man". Of course, if the man page system were perfect you would not be reading this web page and the plethora of people who write "UNIX for Dummies" and those types of books would be without an income. The man page system implies that you already know the command you're looking for! Despite this limitation, it remains a helpful way to remind you when you forget the specifics of a UNIX command you know.
Working In and Moving Through Directories
The most basic of things you'll need to do when logged in is to list the items which are inside your working directory. For this purpose, you use the UNIX ls command. Let's say I've just logged in to the Chemistry email server, chem.udel.edu. This means my working directory is set to the default: my home directory. I type the ls -l command and the following is printed on my screen:
chem 1% ls
total 0
drwxr-xr-x    2  frey       doren         24 May 27 14:57 dumpster
drwx------    2  frey       doren         24 May 27 14:50 mail
chem 2%
The first column, right below the "total 40" text, lists the privileges for the file or directory. In the multiuser operating sytem, files and directories must have this privilege information so that a user cannot go to another user's home directory and modify his or her files! The "d" indicates that the item on this line is a directory; a hyphen ("-") indicates it is a file. Following the initial character is a set of three three-letter entries which show the actual permissions: "r" stands for read-permission, "w" stands for write-permission, and "x" stands for execute-permission (like a program or a script). The absence of one of these letters (as indicated by a hyphen "-") in each of the triads implies that the action cannot be performed. The first set of three letters are the user permissions; what the owner of the file can do with it. The second set of three letters are the group permissions; what other people in the owner's UNIX group can do with the file; on the Chemistry Computing Cluster users are typically grouped by the professor for whom they work, so group privileges apply to other people in your research group who have an account. The final three letters are privileges for any user who logs on to the computer. Moving two columns to the right, the user who owns the file/directory is listed. The next column to the right lists the group associated with the file (and subsequently the UNIX group which gains group privileges to the file/directory). Following that are columns which list disk usage by the file/directory, the date the file/directory was last modified, and finally the file/directory name.

  xercise 1: Make a new directory in your home directory. Call it "Documents".

The UNIX command you'll need is mkdir, short for mAkE dirECTORY. You supply the name of the new directory following the command:
chem 2% mkdir Documents
chem 3% ls
total 0
drwxr-xr-x    2  frey       doren         24 May 27 14:59 Documents
drwxr-xr-x    2  frey       doren         24 May 27 14:57 dumpster
drwx------    2  frey       doren         24 May 27 14:50 mail
chem 4%

  xercise 2: Make the "Documents" directory which you just created your working directory.

The UNIX command you'll need this time is cd, short for cHANGE dIRECTORY. You supply the name of the new directory following the command:
chem 4% cd Documents
chem 5% ls
chem 6%
Notice the ls command produced no output; that's because there's nothing in the "Documents" directory. And remember the whole parent directory/sub-directory thing from section three? The "Documents" directory is a    (1)    directory or your home directory, which makes the home directory the    (2)    directory of "Documents".  ANSWERS

  xercise 3: Now that "Documents" is your working directory, make a new directory called "Tutorlia" inside it.

The command you typed was    (3)   .  ANSWERS  The output should look like:
chem 7% ls
total 0
drwxr-xr-x    2  frey       doren         24 May 27 15:05 Tutorlia
chem 8%

  xercise 4: Uh-oh! We misspelled "Tutorial" for that last directory. So let's rename it and then make it our working directory.

To correct the spelling we need the UNIX mv command, short for mOvE. It's not immediately obvious that renaming a file or directory is accomplished by moving it, but in essence you're moving the contents of the file/directory to a new file/directory with a different name. To rename our "Tutorlia" directory, you specify the old location/filename first, the new second:
chem 9% mv Tutorlia Tutorial
chem 10% ls
total 0
drwxr-xr-x    2  frey       doren         24 May 27 15:05 Tutorial
chem 11%
To make "Tutorial" your working directory, you type    (4)   .  ANSWERS

At this point you've succeeded in creating a directory inside which you'll store all of the examples that we work through in this tutorial. As you become more experienced with UNIX you'll get the hang of all these file commands. Plus, we'll revisit file and directory commands in a later section.
On to next page.

Answers to Questions

(1) sub

(2) parent

(3) mkdir Tutorlia

(4) cd Tutorial