CSCI 2330
Introduction to Systems

Bowdoin College
Spring 2016
Instructor: Sean Barker

Project 0 - Unix Warmup and Environment Setup

This project should be completed individually.

This project is designed to introduce and familiarize you with many of the tools that we will be using throughout the semester. Most significantly, this project will teach you the basics of working in a Unix environment, using the command line, and writing and running programs on remote servers. Getting a handle on your working environment early on will save you lots of time in the long run and let you focus on the actual course material of the later projects.

Part 1 - Unix Crash Course

Go through the Command-Line Unix Crash Course. If you have never worked in a command-line environment before, this tutorial may take you some time. If you have extensive Unix background, you may already have seen most of this material (but you should still at least skim the tutorial to make sure).

There is nothing to submit for this part.

Part 2 - CSCI 2330 Environment Setup

The Unix tutorial above had you working on Bowdoin's campus-wide Linux machine (or, if you're on a Mac or a Linux machine yourself, you may have done the tutorial on your own local machine). However, for the rest of the course, you must use the designated CSCI 2330 Linux server for all projects. Even if the project files appear to compile and run on your local machine, there are subtle differences between Linux and OS X, and between different version of Linux, that may cause hard-to-debug problems. Avoid these problems by always working on the class server (which is also the server that will be used to evaluate your programs)!

In this part, you will configure your account on the class server and then complete a few simple tasks on the server to check your understanding. The main objective here is to make sure all systems issues are resolved now, and not right before the first 'real' project is due.

If you are unsure how to accomplish any of the tasks in this part, your first stop should be the Unix tutorial above. After that, you should consult Piazza, the instructor, TAs, etc.

Accessing the CSCI 2330 Server

The name of the class server is You have been provided an account on this server that will allow you to log in and work on your projects.

Access to the server requires the use of a keypair, which you should have received via email. Your keypair consists of a private key file (named something like username-keypair) and a corresponding public key file (named something like Using a keypair to login instead of a password is (1) more secure, since an attacker could guess your password, but cannot guess your key, and (2) more convenient, since you will not have to type in a password to login. In fact, you do not even have a password associated with your server account - your keypair is the only way you can login.

Keep your keypair safe, as it provides access to your server account. Don't send anyone your keypair file or leave it anywhere publicly accessible - this is like telling someone your password!

To login to the server using your private key (assuming userid is your username) from either a Mac or a Linux machine, open a terminal window and use ssh to login as follows:

ssh -i userid-keypair

Remember to use your actual username instead of userid, and note that the above assumes that userid-keypair is in the same directory from which you are running the command.

If you get an error that references the permissions on your keypair file, you can fix that using the chmod command as shown below, then try running ssh again:

chmod 600 userid-keypair*

If you are logging in from Windows, you can use PuTTY as discussed in the tutorial, but will need to configure PuTTY to use your private key file. To do so, within PuTTY, go to Connection, then SSH, then Auth, then click Browse next to 'Private key file for authentication'. Change the 'Files of type' setting to 'All files', then select your private key file (e.g., username-keypair - NOT your public key file ending in .pub). Now you should be able to login in the usual way to the class server and your private key file will be used.

The server provides a full-fledged Linux environment with all the standard development tools (editors, compilers, version control, etc) preinstalled. If there is any software that you would like to use that is not already installed on the server, please email me.

Checking out your SVN directory

We will use Subversion for storing and submitting all projects. Using Subversion has several advantages: (1) your work will be backed up in the Subversion repository, (2) it will be easy to work in groups later on, and (3) it provides an easy way for me to access your project files, both before and after you have officially 'submitted'.

Each of you has a dedicated directory on Bowdoin's Subversion server for your work in this class, which you and only you can access. Your personal directory is at the following directory (again using your actual username instead of userid):

Login to the class server, then checkout your SVN directory. Once you have checked it out, it will appear as a directory named userid (your actual username) in your current directory. You may wish to rename the checked-out directory to something more informative (like cs2330) using the mv command. Initially, there are no files within your SVN directory.

Part 3 - Sanity Check

Your last task is to write a very simple C program, a Makefile for this program, and then check your files into your SVN directory. Within your SVN directory, do the following:

  1. Create a directory called proj0 which will serve as your project folder.
  2. Write a C program called add, which should be written in a file called add.c and stored in your new project folder. The specification for the add program is very simple: the program should accept one or more numbers as command-line arguments, and should simply print out their sum. You will find the built-in function atoi helpful here. If called with no command-line arguments, the program should print out the exact error message "Usage: ./add [num1] [num2] ...", as shown below. For example:
    $ ./add 30 40
    $ ./add 3 10 2
    $ ./add -8 5
    $ ./add 2
    $ ./add
    Usage: ./add [num1] [num2] ...
    You may assume that you will only get numeric command-line arguments (i.e., you do not have to gracefully handle textual arguments). Your name should be included in a comment at the top of your program.
  3. Write a Makefile for your C program. Your Makefile should have two targets: the default target (which you can call add) which compiles the program, and a clean target that cleans up the compiled files (here, just the add executable). Follow the Makefile example given in the Unix tutorial. Remember that this is a plain C program, not a C++ program, and therefore you should be using gcc instead of g++. Also by convention, the Makefile variables you should use for a C program are CC and CCFLAGS instead of their CXX equivalents. Lastly, you will likely want to add -std=c99 to the compile flags, as otherwise gcc will complain about many simple things that you might like to do, such as declaring a loop variable inside the loop header.
  4. Once your program is finished, I should be able to run the following set of commands from your project directory to compile your program, run it (using any integer inputs), and then clean up:
    $ make
    $ ./add 2 7
    $ make clean
  5. Add your entire proj0 directory to the SVN repository using svn add, then commit your files using svn commit. This constitutes 'submitting' your project, although you may also make changes later on; the most recently committed files in your SVN directory will be considered your submission. Note that you need not check in your compiled executable to SVN (since this can be immediately regenerated using the Makefile).


While this project is only a warmup, your submission will be checked based on the following criteria:

  1. Does your program follow the specification above?
  2. Does your program include a Makefile with both the default target and a clean target?
  3. Are all your files checked into your Subversion directory in the proj0 subdirectory?