Homework #1 - Getting Familiar with PuTTY and gedit

10 Points

 

Before you begin:  Computers expect you to do things exactly as they require (for example capitalization often matters so "A" is different from "a".  Therefore, you *must* follow directions carefully, and if something goes wrong, try again at least once, more carefully.  Good luck.

Purpose:  This first homework is just trying to get you familiar with doing something useful on the linux computers first with PuTTY and then with gedit. Please be sure to do all twelve steps (instructions appear below the summary).  Also please note, Xming must be started BEFORE beginning this assignment otherwise you'll get the warning:  Gtk-WARNING **: cannot open display: localhost:10.0.  To start Xming, just double click on the Xming icon on your desktop (by default it is placed there when installing Xming.  If you have not installed Xming yet, you can get it here).

Summary:  Using PuTTY do the following:

Instructions:

Follow the instruction written in bold exactly in the order presented below and you should be successful. 

Note:  whenever you are asked to type something in quotes, type it exactly as it appears (without the quotes of course) except for what appears in italics.  If something appears in italics it means you are to substitute the appropriate information where the italics appear.  For example:  if you were asked to type:  "yada username <CR>", you would actually type something like, "yada joeschmo <CR>" (but without the quotes), if joeschmo was your username.  Get it?

By the way, <CR> stands for the "Enter" key (actually it stands for carriage return from the days long ago days of  typewriters).  Whenever you see <CR>, press the "Enter" key.  Since we always type a <CR> after every command, I'll not mention it anymore, but be sure to do it.

1. Login to the System with PuTTY.

    You can do this by following the directions on the course web page (first lesson) also located here.  Then come back to this page

2. Open the gedit program.

    You can do this by typing the command "gedit &" at the linux command prompt (the prompt looks like john: ~> or james: ~>).

3.  Copy a Sample Program from the Web Site to the Linux Computer:

  1. Click on the link here, highlight the entire program (hello.cpp), and copy it to the clipboard (e.g., using <CTRL-c> or right-click and choose copy).
  2. In the main gedit window (i.e., the big white part of the screen) paste the clipboard contents (e.g., with <CTRL-v> or right-click and choose paste).

4.  Save the Sample Program to the Linux Computer as "hello.cpp".

  1. Do one of the following (1) click on the Save button in the toolbar, or (2) choose "File ... Save" from the menu, or (3) type <CTRL-s> to save the sample program to the linux computers.
  2. In the save dialog that appears, type the file name "hello.cpp" and click the save button.

5.  Compile hello.cpp

  1. Now move your focus to the PuTTY terminal window (that's the black window where you first typed "gedit &") and press the <ENTER> key a few times to see the command prompt.
  2. Now type:  "g++ hello.cpp" and press <CR> (this compiles the program).

6.  Run the program by typing"a.out" (make sure you type "a.out" in the terminal window, that's the place where you run linx commands).

  1. The message. "Hello world!" should be printed in the terminal window.  If you didn't get this message, then try again, or get someone to help you, until you get it right).

7.  Submit your program for grading by typing "submit" and answering the questions

  1. FYI, the answers are:
    1. Either "1" or "2", depending on your section (9AM is "1", 2PM is "2")
    2. "HW1" for this assignment. Your next assignment will be--you guessed it--"HW2".
    3. "hello.cpp" - this is the name you should have used to save your file in step 3.
  2. If you did everything correctly, the submit program will tell you that you were successful. If you were not successful, try again, or get someone to help you walk through the steps again that was successful. If you just can't get it done, then send your instructor an email letter him or her know.

8.  Close gedit by clicking on the red 'X' or choosing "File ... Quit" from the menu.

9.  Show a list of your files by typing "ls" in the PuTTY window.

10.  Make a copy of "hello.cpp" by typing "cp hello.cpp hello_copy.cpp"

11.  Submit "hello_copy.cpp" for grading by typing "submit" and answering the questions

  1. FYI, the answers are:
    1. Either "1" or "2", depending on your section (9AM is "1", 2PM is "2")
    2. "HW1" for this part of the assignment also, since you're still working on homework 1
    3. "hello_copy.cpp" - this is the name you should have used in step 10.

12.  Log off the linux computer by typing  "exit"

 

This completes the assignment