How Do I

  1. How do I start putty so I can login onto the CS server and do programming? How do I check that putty is installed on my computer?
    1. Start Windows.
    2. Look for the putty icon. It says putty under it. The picture is of two computers connected by a yellow lightning bolt.
    3. If you do not see this icon, putty is not on your computer. Go go to step 2 below to download and install putty.
    4. Start putty by Double clicking on the putty icon. This pulls up a window.
    5. Click on the Run button in the window.
    6. This pulls up a connection window. Under "Host Name (or IP address)" enter the server name:
      Be sure to press the enter key after typing the name. (Note: if a window pops up, click on "Yes"). This should connect to the CS server. Go to step 3 to complete logging into the CS server.
  2. How do I download and install putty?
    1. Start a browser.
    2. Go to the official putty download web site by clicking on the link.
    3. Scroll down to find the correct program. This would be


    4. Click on putty.exe, this pulls up a window.
    5. Click on Save File.
    6. Click on Save. Get out of the browser. You should have the putty icon on your screen.
  3. How do I logon to the CS server so I can program?
    1. Start putty (see Question 1 above).
    2. The next thing you should see is a terminal window provided by the server with the words
      login as:
      At this point you should enter your CS server user name (unixName). Read the Syllabus to see how to find your unixName and password on blackboard. Next the CS server asks for your password:'s password:
      where cs151ddd is your user name, with the three d's standing for the last three digits in your user name.. Type in your password. NOTHING appears on the screen. If you make a mistake you can use the backspace key. Press enter when you finish.
    3. You have logged on successfully if you now see your command prompt:
      where the ddd's stand for last three digits of your user name. The command prompt is prompting you enter a command. Each time you enter a command, the command is carried out, and you are given a new command prompt so you can enter another command.

      When you use the pico command (see 5 below) to write a file, you interact with pico. You do not immediately get a new command prompt. Command pico collects what you type to be put into the file until you type ^O and ^X (see below). When you type ^X pico stops and you get a new command prompt.

  4. How do I Log Off the CS server? When you are finished working on the server, get back to the command prompt. (for instance if you are still in pico-- see below-- type ^X to get out of pico) then enter the command
    That is type exit and press the return or enter key.
  5. How do I write, save, compile, and run a C program?
    1. If not already logged on, logon to the CS server (see Question 3 above).
    2. Writing the Program: We will write our first C program file. Its name will be: first.c. Its goal is to print out the following message:
            This is program 1, it's my first!
      1. Enter the command: pico first.c
        That is, type the command and press the enter key. This command starts the pico editor which lets you write files, and in this case you want to work on the file first.c. Now type in:
        int main() {
          printf("This is program %d, its my %s!\n", 1, "first");
      2. Now save your work. Type ^O (that is, hold down the ctrl or control key and type an O). This brings up the line:
        File Name to write: first.c
        You have the option of changing the name (backspace, type a new name). In this case just press the enter key to accept first.c as the file name for the program.
      3. Now get out of pico. Type ^X (type the X while holding down the ctrl key) to exit pico.
    3. You can check that you have been successful with creating the file by entering the command:
      Remember to press the enter key after typing ls. This command lists out all files in your account. You should see the name
    4. Compile the program. If your program has no grammar errors, the compile step makes a new file that contains the the machine language translation of your C code (program). This new file is executable, that is, it can be run on the computer. The compile command is gcc. The complete command is
      gcc first.c
      since we need to tell the operating system what C program file we want to compile. Remember to press the enter key.

      If the compiler detects grammar errors (syntax errors), it prints messages on the screen telling you about the errors. If you have errors, you must use pico:

      pico first.c
      to work on your C program. Once you have corrected the errors, re-compile the file. If no error messages appear, the compile has been successful. The machine language will be in a file, a.out. Again you can enter the ls command. It should show that you have two files: a.out and first.c.
    5. Run the program. Enter the command:
  6. How do I change an C program? You repeat the steps of question 5 above with the name of your program file in place of first.c.