Computer Science 322
Operating Systems

Mount Holyoke College
Spring 2010

Lab 0: Getting (Re)acquainted with C and Unix
Due: 2:40 PM, Monday, February 1, 2010

The purpose of this first lab assignment is to acquaint or reaquaint you with the Unix systems in the CS department and how to run a C program in those environments. None of these tasks is intended to be hard, but if you don't have much Unix experience, they could be. So...ask if you are not sure what to do! I expect plenty of questions.

Logging into Unix Environments

We will be using several Unix-based systems within the Computer Science department. Log into and familiarize yourself with your CS Unix account in each of three environments. Later in the semester, I hope to set up a Sparc/Solaris system for our use.

Unix Commands

Identify the function of and experiment with these Unix Commands:

ls    cd      cp      mv     rm     mkdir   pwd
man   chmod   cat     more   grep   head    tail
ln    find    rmdir   wc     diff   tar     touch

The Emacs Editor

Emacs (emacs from the Unix command line) is a powerful text editor. You will want to become familiar with it if you are not already. Identify the function of and experiment with these Emacs commands:

C-x C-s   C-x C-c   C-x C-f   C-x C-w   C-g   C-a   C-e        
C-d       C-_       C-v       M-v       C-s   C-r   M-%

C- before a key means hold down Ctrl and hit that key. M- indicates the "Meta" key, which on most systems is Esc. To issue a Meta command, hit the Esc key, release it, then hit the key for the command you wish to issue. Use the keystrokes rather than the menus. It will save you time in the long run!

Include a brief description of each Emacs keystroke in your file unix.txt.

Learn these commands - you will use them often. Hints can be found in the Unix and Emacs web pages linked from the course website. Ask others in the lab if you're not sure how to do something in the Unix environment. Share your tips and tricks with each other.

Note: when logged into the Clapp 202 Linux systems, Emacs will open in its own window and allow you to use the mouse to move the cursor and to operate the menus. When logging in remotely, you need to forward your X11 display to your screen. To do this from the CS Linux systems, you will need to add the -Y flag to your ssh command.

Verify that you can display an Emacs window from to one of the Clapp 202 Linux systems. To get your prompt back (by running Emacs - or any command for that matter - in the background), follow your command line with an &. This will allow you to work in Emacs and your terminal window concurrently.

Running a Simple C Program


To submit this lab, place all of the files that you are to turn in (and nothing else) into a directory, change to that directory, and create a "tar file" to submit.

tar cvf intro.tar *.txt ls.out Makefile

This will create a file intro.tar in your directory. Send this tar file as an attachment to jteresco AT by 2:40 PM, Monday, February 1, 2010.

Please include a meaningful subject line (something like "CS322 Lab 0 Submission") and use the exact filenames specified (for this lab and all semester) to make my job easier when gathering your submissions together for grading. You don't want to annoy your grader with misnamed or missing files just before he grades your assignment. Please do not include any additional files, such as emacs backup files, object files, or executable programs.