CMSC 104, Fall 2012
Homework 2
Testing Lab2 Results
Out: Thursday 9/20/12
Due: Before 11:59 PM on Monday,
September 24
Note that late homeworks will NOT
be accepted.
The Objectives
- To demonstrate that you performed Lab 2 correctly
- To practice redirecting the output of Unix commands
The Assignment
The purpose of this homework is to ensure that you have executed Lab 2 correctly. Since the directory structure that you will hopefully have set up in that lab will be used for the rest of semester to create, organize, test and submit your homeworks and projects, it is important that you created it correctly.
Secondly, this homework will test some parts of your working Linux knowledge. Note that we tell you what you must do for each step of the assignment, but not necessarily how you are to do it--that part is left up to you to figure out!
-
You must first correct an error that was in Lab 2. It is
an artifact of the previous versions of CMSC 104 being
JavaScript- and web-based. Relative to your home directory,
you were told to go into "../pub/www", create a directory
there called "cs104", and then go into "cs104" and create
subdirectories for hw3, hw4, proj1, etc. That was the wrong
place to create this subtree. You need to move it into your
home directory. To do this, first log in to your account,
and while in your home directory, do the following:
linux1[2]% pwd /afs/umbc.edu/users/j/d/jdoe1/home linux1[3]% mv ../pub/www/cs104 . linux1[4]%
At this point, you should still be in your home directory (you didn't do any "cd" commands, right?), but the "cs104" directory should now be a subdirectory of your home directory. Change into the "cs104" subdirectory, and make sure you see the subdirectories "hw3", "hw4", "proj1", "proj2", and "proj3".
- We did not have you create enough subdirectories in Lab 2. Create additional subdirectories "hw5" through "hw8" under the "cs104" directory -- you should know how to do that.
-
Your next task is to create and submit a listing of the
directory that will convince us you followed the instructions
in Lab 2 correctly.
- First, make sure you are still in your "cs104" subdirectory
-
Next, try out the following command for your own enlightenment:
linux1[4]% pwd /afs/umbc.edu/users/j/d/jdoe1/home/cs104 linux1[5]% ls -l -R .: total 18 drwxr-xr-x 2 park rpc 2048 Sep 20 09:41 hw3 drwxr-xr-x 2 park rpc 2048 Sep 20 09:41 hw4 drwxr-xr-x 2 park rpc 2048 Sep 20 09:41 hw5 drwxr-xr-x 2 park rpc 2048 Sep 20 09:41 hw6 drwxr-xr-x 2 park rpc 2048 Sep 20 09:41 hw7 drwxr-xr-x 2 park rpc 2048 Sep 20 09:41 hw8 drwxr-xr-x 2 park rpc 2048 Sep 20 09:41 proj1 drwxr-xr-x 2 park rpc 2048 Sep 20 09:41 proj2 drwxr-xr-x 2 park rpc 2048 Sep 20 09:41 proj3 ./hw3: total 0 ./hw4: total 0 ./hw5: total 0 ./hw6: total 0 ./hw7: total 0 ./hw8: total 0 ./proj1: total 0 ./proj2: total 0 ./proj3: total 0
Now, the thing you have to figure out: how can you send the output of this command into a file? The answer is in the lecture notes on Linux and Operating Systems. I want you to use I/O redirection to do this. It's up to you to figure it out! DO NOT USE WINDOWS CUT-AND-PASTE to do this!!!
Get the output of the "ls -l -R" command into a file called "hw2.txt", and then submit this file into the project "Hw2", by using the command:
linux1[6]% submit cs104_park Hw2 hw2.txt linux1[7]%