CS 136

Spring 2006
Williams College

Unix on the Mac Tutorial

This tutorial will help you get started with the unix operating system which we will be using this semester. It assumes no unix background, but it does assume that you are comfortable using Mac OS X (the OS run by the machines in cs217a). To get started, sit down at a Mac in the lab and go through this tutorial, trying things out as you go. I recommend having two windows side-by-side on the screen, a browser with this tutorial in one window, and a window of the terminal program as the other window.

Opening a Terminal Window

In this course, we will be using the OS X terminal program as an interface to unix. This program should be in your dock and has a black box as an icon. Click on the icon, and this will bring up a terminal window. You can also reach this program by going to /Applications/Utilities and clicking on Terminal.

The window opened is called a "shell" window in which you will type unix commands. You type commands at the "prompt." The prompt is different on different machines, but will probably look like "->" for you. It may also consist of the computer's name and your location in the file system, as in:

Stacias-Computer:~ stacia$

Here, Stacias-Computer is the name of the computer, and ~ stacia is the direcotry I am in (my home directory, since my userid is stacia). In unix, directories are equivalent to folders. In this tutorial, I will simply use -> as the prompt. Try typing the command "ls" at the prompt and press return. This command will list the files in your directory. To get help on any unix command, you type "man" followed by the command at the prompt. For example:

-> man ls

will you give you help for the command ls. Unix is case-sensitive, so LS is not the same command as ls. Also, always set your unix shell windows to 80 columns wide (the size of the window is on the banner at the top of the window). Many unix programs count on the shell window being 80 columns wide.

5 Part Tutorial

The unix part of this tutorial has been broken up into 5 chunks, linked to below:

Part One

Part Two

Part Three

Part Four

Part Five