CMSC 104, Section 01, Fall 2016
Problem Solving and Computer Programming

Project 1


Due Date: Thursday, September 22nd @ 5:30 PM

Point Value: This project is graded with a 25 point max score.

Objectives:

To become familiar with: Part A of this project is meant to be performed in the lab with the assistance of your instructor and TA. However, if you do not finish, you must do so on your own time. Part B of this project should be performed on your own time.

Part A: (10 points)
The purpose of this part of the project is to answer a survey. It demonstrates your ability to log into the UMBC GL Linux system, create directories and files, and submit assignments.

  1. Log into the machine in front of you using your UMBC Credentials
  2. Open a terminal window
  3. SSH into the GL Linux machine using the following command: ssh linux.gl.umbc.edu
  4. By default you will be logged into your home directory. To see where your home directory is, type pwd
  5. Create a new directory for this class using the command mkdir cmsc104
  6. Traverse into the new directory you just created cd cmsc104
  7. Run the pwd command again. You should see that you're now in the cmsc104 directory.
  8. Download the survey template to the current directory using the following command:

    curl -O http://userpages.umbc.edu/~reicht1/classes/cmsc104/fall16/proj1a_template.txt

  9. Type ls -al to list the contents of your proj1 directory. You should see the proj1a_template.txt file.
  10. Rename the proj1a_template.txt file to campusidnumber_proj1a.txt where campusidnumber is the Campus ID number on your UMBC ID card below your name (hint: it typically starts with two letters). Use the following command: mv proj1a_template.txt AB12345_proj1a.txt
  11. Run the ls -al command to list the contents of your proj1 directory. You should see the AB12345_proj1a.txt file has been renamed.
  12. Open the template file using the nano text editor by running the following command: nano AB12345_proj1a.txt
  13. Fill in the template.
  14. Close and save the template. Use Ctrl-X to when you're ready to quit nano, and follow the prompts at the bottom of the screen to save the file.
  15. You should be back at the linux command prompt. Now we want to verify that the file was saved properly. Run the command cat AB12345_proj1a.txt. You should see your text document dumped to the command line.
  16. When you're satisfied with your survey and ready to submit, run the following command to submit your project:

    curl -L -F file=@AB12345_proj1a.txt http://userpages.umbc.edu/~reicht1/classes/cmsc104/fall16/submit.php

  17. Just to be safe, I'm also going to ask each of you to e-mail me your project file as an attachment. DO NOT place the text directly in the contents of the e-mail! There's a number of ways to get your project file off the GL Linux machine so that you can attach it to an e-mail. We'll go through one right now.
  18. In the terminal window, rerun the cat AB12345_proj1a.txt command.
  19. Using the mouse, select all the text from your document, and go to Edit->Copy.
  20. On the local machine, open Notepad (if it's Windows, Winkey+r -> notepad; on other OSes, open the text editor) and paste in the contents.
  21. Save the file on the local machine to an easy to access location (desktop?). Give it the same filename (AB12345_proj1a.txt).
  22. Open your UMBC E-mail in a web browser and create a new message.
  23. Use the subject line Project Submission - 1A - Lastname, Firstname with your name in the place of the placeholders. Note: Getting this right will be part of your style grade!
  24. Attach the file to your email.
  25. Send the email to reich1@umbc.edu.
  26. Be sure to log off of your GL session! Go back to your terminal window and run the exit command.


Part B: (15 points)
The purpose of this part of the project is to become more familiar with the Linux command line, get acquainted with emacs, and use the internet to download and execute a simple shell program.

I highly recommend that you attempt this on your home PC if you plan on doing development work at home. The TA will be available on Tuesday during class time to help you if you run into problems. Refer to the slides in the first lecture for more information on how to SSH into GL from your home computer. Windows users, use PuTTY. Mac users, open Terminal.

  1. SSH into the GL Linux machine using the following command (note: PuTTY users can skip this step!): ssh userid@linux.gl.umbc.edu
  2. Traverse into the directory you made for cmsc104 in Part A of the assignment: cd cmsc104
  3. Create a new directory for this project using the command mkdir proj1
  4. Traverse into the new directory using cd proj1
  5. Verify you're in the correct directory using pwd. The rest of this assignment should be completed from inside this directory.
  6. Download the answer template to the current directory using the following command (hint: copy the command from your browser and paste into the terminal window! PuTTY users, right click the mouse anywhere in the terminal window to paste. Everyone else, use Edit>Paste.):

    curl -O http://userpages.umbc.edu/~reicht1/classes/cmsc104/fall16/proj1b_template.txt

  7. Use nano to view the downloaded file (nano proj1b_template.txt) and fill in the answers to the questions below. You might find it easier to write the answers on paper or in a separate window as you go, and then fill in the response template all at once.
  8. Execute the following command. What is the result? echo CMSC104 is awesome
  9. The character > is used to redirect the output of a command. When used, it will create a file that contains the output of the command that preceeds the character >. Execute the following commands:
    • echo hello1 > one
    • echo hello2 > two
    • echo hello3 > three
    Executing these three commands should result in three files being created. An ls command will list these files.
  10. Execute the following command. What do you see? more one
  11. Execute the following command. Describe the output. more *
  12. Execute the following command. Describe the output. more ???
  13. Execute the following command. Describe the output. more ????*
  14. Execute the following command. Describe the result. (hint: use ls to help describe what happened) mkdir a b c
  15. Traverse into the a directory using the cd command. Execute the following command and describe the result. cp ../one ./
  16. Execute the following command. Describe the result. cd ../b
  17. Open emacs by executing the emacs command. Typically emacs will open in text mode in your terminal window, however if you are on a native *nix system, emacs may "pop out" into a separate window with a Graphical User Interface (GUI). Regardless of which version you see, the keyboard commands should perform the same actions.
  18. Type the following to quit emacs: [Ctrl]-x [Ctrl]-c
  19. Execute the following command. Describe the result. (hint: use ls to help describe what happened) touch numbers
  20. Open the numbers file with emacs. emacs numbers
  21. Enter the numbers 1 through 10, one number per line.
  22. Quit emacs. Follow the prompts to save the file.
  23. Execute the following command. Describe the result. sort -nr numbers
  24. Execute the following command. Describe the result. sort -r numbers
  25. Execute the following command. Describe the result. (hint: run it multiple times) sort -R numbers
  26. Execute the following command. Describe the result. (hint: use more, ls, cd, and man to describe what happened) tail -2 numbers > ../c/somenumbers
  27. Traverse back to your proj1 directory.
  28. Use the following curl command to download the program proj1-hello from the internet (hint: cut the command from your browser and paste it into the terminal window!).

    curl -O http://userpages.umbc.edu/~reicht1/classes/cmsc104/fall16/proj1-hello

  29. Use ls to confirm the program proj1-hello was downloaded.
  30. You will need to give the proj1-hello program execute permissions before you are able to execute it. To do this, execute the following command: chmod +x proj1-hello
  31. Use ls -al to get a detailed directory listing including file permissions. For proj1-hello permissions should now include x.
  32. Execute the proj1-hello program using the following command. Describe the output. ./proj1-hello
  33. One more thing! Use the cd and ls commands to draw a directory structure below your proj1 directory. We reviewed directory structures in the last lecture.

When you have completed the steps above, type up your responses in the provided template and save it to a file named campusidnumber_proj1b.txt, replacing campusidnumber with the Campus ID number below your name on your UMBC ID (e.g. AB12345), and submit it using the following command (hint: copy the command from your browser and paste it in the terminal window, but remember to put in your campus ID!):

curl -L -F file=@campusid_proj1b.txt http://userpages.umbc.edu/~reicht1/classes/cmsc104/fall16/submit.php

Additionally, email your campusid_proj1b.txt file as an attachment to reicht1@umbc.edu using the subject line Project Submission - 1B - Lastname, Firstname, replacing Lastname, Firstname with your name.

Last Modified: September 15th, 2016 10:34 PM