CMSC 104, Section 01, Fall 2016
Problem Solving and Computer Programming
Thursday, September 22nd @ 5:30 PM
This project is graded with a 25 point max score.
To become familiar with:
- Logging onto and off of the UMBC GL Linux System
- Use of basic Linux command line commands
- Creating a text document using nano
- Submitting your work electronically
- Basic use of the emacs editor
- Executing a simple shell program
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.
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.
- Log into the machine in front of you using your UMBC Credentials
- Open a terminal window
- SSH into the GL Linux machine using the following command: ssh linux.gl.umbc.edu
- By default you will be logged into your home directory. To see where your home directory is, type pwd
- Create a new directory for this class using the command mkdir cmsc104
- Traverse into the new directory you just created cd cmsc104
- Run the pwd command again. You should see that you're now in the cmsc104 directory.
- 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
- Type ls -al to list the contents of your proj1 directory. You should see the proj1a_template.txt file.
- 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
- Run the ls -al command to list the contents of your proj1 directory. You should see the AB12345_proj1a.txt file has been renamed.
- Open the template file using the nano text editor by running the following command: nano AB12345_proj1a.txt
- Fill in the template.
- 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.
- 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.
- 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
- 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.
- In the terminal window, rerun the cat AB12345_proj1a.txt command.
- Using the mouse, select all the text from your document, and go to Edit->Copy.
- 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.
- Save the file on the local machine to an easy to access location (desktop?). Give it the same filename (AB12345_proj1a.txt).
- Open your UMBC E-mail in a web browser and create a new message.
- 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!
- Attach the file to your email.
- Send the email to firstname.lastname@example.org.
- Be sure to log off of your GL session! Go back to your terminal window and run the exit command.
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.
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.
- SSH into the GL Linux machine using the following command (note: PuTTY users can skip this step!): ssh email@example.com
- Traverse into the directory you made for cmsc104 in Part A of the assignment: cd cmsc104
- Create a new directory for this project using the command mkdir proj1
- Traverse into the new directory using cd proj1
- Verify you're in the correct directory using pwd. The rest of this assignment should be completed from inside this directory.
- 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
- 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.
- Execute the following command. What is the result? echo CMSC104 is awesome
- 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:
Executing these three commands should result in three files being created. An ls command will list these files.
- echo hello1 > one
- echo hello2 > two
- echo hello3 > three
- Execute the following command. What do you see? more one
- Execute the following command. Describe the output. more *
- Execute the following command. Describe the output. more ???
- Execute the following command. Describe the output. more ????*
- Execute the following command. Describe the result. (hint: use ls to help describe what happened) mkdir a b c
- Traverse into the a directory using the cd command. Execute the following command and describe the result. cp ../one ./
- Execute the following command. Describe the result. cd ../b
- 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.
- Type the following to quit emacs: [Ctrl]-x [Ctrl]-c
- Execute the following command. Describe the result. (hint: use ls to help describe what happened) touch numbers
- Open the numbers file with emacs. emacs numbers
- Enter the numbers 1 through 10, one number per line.
- Quit emacs. Follow the prompts to save the file.
- Execute the following command. Describe the result. sort -nr numbers
- Execute the following command. Describe the result. sort -r numbers
- Execute the following command. Describe the result. (hint: run it multiple times) sort -R numbers
- Execute the following command. Describe the result. (hint: use more, ls, cd, and man to describe what happened) tail -2 numbers > ../c/somenumbers
- Traverse back to your proj1 directory.
- 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
- Use ls to confirm the program proj1-hello was downloaded.
- 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
- Use ls -al to get a detailed directory listing including file permissions. For proj1-hello permissions should now include x.
- Execute the proj1-hello program using the following command. Describe the output. ./proj1-hello
- 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 firstname.lastname@example.org
using the subject line Project Submission - 1B - Lastname, Firstname
, replacing Lastname, Firstname
with your name.
Last Modified: September 15th, 2016 10:34 PM