Updated: 2013-05-08 21:04 EDT
11h00 (11am) Monday February 11, 2013 (start of Week 6)
WARNING: Some inattentive students upload Assignment #3 into the Assignment #2 upload area. Don’t make that mistake! Be exact.
This assignment is based on your weekly Class Notes.
Remember to READ ALL THE WORDS to work effectively and not waste time.
This is an overview of what you will do in this assignment. Read all the words before you start working.
Complete the numbered Tasks listed below on the Course Linux Server (CLS). Run a Checking Program to verify your work as you finish each task. Submit your marks to Blackboard.
You will create file system structure in your CLS home directory containing various directories and files. You can use the Checking Program to check your work as you do the tasks. You can check your work with the checking program as often as you like before you submit your final mark. (Some tasks sections below require you to finish the whole section before running the checking program; you may not always be able to run the checking program successfully after every single task step.)
When you are finished the tasks, leave these files, directories, and links in place on the CLS as part of your deliverables. Do not delete any assignment work from the CLS until after the term is over! Assignments may be re-marked at any time on the CLS; you must have your term work available on the CLS right until term end.
Do all this work logged in to your account on the CLS.
Do the following numbered tasks in order, from top to bottom. READ ALL THE WORDS! and do not skip steps.
Your instructor will mark on the due date the work you do in your account on the CLS. Leave all your work on the CLS and do not modify it. Do not delete any assignment work from the CLS until after the course is over.
All references to the “Source Directory” below are to the directory
~idallen/cst8207/13w/assignment03/
and that name starts with a tilde character “~
” followed by a userid with no intervening slash. The leading tilde indicates to the shell that the pathname starts with the HOME directory of the account idallen
.
Do the Lab Worksheet #03 ODT before this assignment. Record all your answers for later quizzes.
Set your prompt every time you log in to the CLS, so that the prompt changes to tell you you the basename of your current working directory. This is faster than typing pwd
all the time!
RTFM and find the single-letter option to the copy program that preserves mode, ownership, and timestamps when you copy. You will need this, below.
Create the following directory structure in your CLS HOME directory and record (for study purposes) the series of Unix commands you used to create it. Spelling and capitalization must be exactly as shown:
CST8207-13W/
`-- Assignments
`-- assignment03
`-- top1
|-- dir1
| `-- dir1-1
`-- dir2
`-- dir2-1
Note: You can create the entire directory tree above using one single command with one option and two pathname arguments. System administrators like to work efficiently - they learn how to do things quickly.
Make the top1
directory your current directory and then use a command to recursively generate a list of all pathnames under your current directory. The recursive output of all pathnames under your current directory will be exactly five lines long and will contain this exact line in the output somewhere (along with another four lines):
./dir2/dir2-1
Note that there is no punctuation at the end of any pathname.
When the recursive output above on your screen looks correct, redirect the five lines of output of the command into the file named “top1find.txt
” in the assignment03
directory (not in the current directory). The word count of this file must be: 5 5 44
.
Under assignment03
create another directory top2
that contains a copy of everything you created under top1
, with the timestamps preserved. (Hint: The fastest way to do this is with a single recursive copy command, as you did in Lab Worksheet #03 HTML, but add the option to preserve timestamps.)
Create an empty file named MT
in each of the five directories from top2
down. (You can do this with one command name and five pathnames.)
Make the top2
directory your current directory and then use a command to recursively generate a list of all pathnames under your current directory. The recursive output of all pathnames under your current directory will be exactly ten lines long and will contain this exact line in the output somewhere (along with another nine lines):
./dir2/dir2-1/MT
Note that there is no punctuation at the end of any pathname.
When the recursive output above on your screen looks correct, redirect the ten lines of output of the command into the file named “top2find.txt
” in the assignment03
directory. The word count of this file must be: 10 10 103
.
Under assignment03
create another directory top3
that contains a copy of everything that you created under top2
, with timestamps preserved. (Hint: See the previous Hint!)
Under top3
rename each of the MT
files to have the number of the parent directory that contains it, e.g. rename ./MT
to be ./MT3
and dir2-1/MT
to be dir2-1/MT2-1
, etc.
Make the top3
directory your current directory and then use a command to recursively generate a list of all pathnames under your current directory. The recursive output of all pathnames under your current directory will be exactly ten lines long and will contain this exact line in the output somewhere (along with another nine lines):
./dir2/dir2-1/MT2-1
When the recursive output above on your screen looks correct, redirect the ten lines of output of the command into the file named “top3find.txt
” in the assignment03
directory. The word count of this file must be: 10 10 112
.
Run the Checking Program to verify your work so far.
maze
” that leads to the same directory maze used in a previous assignment: Assignment #2 HTML. Again, you must find files in this maze, but the symbolic link requires some special handling because find
does not follow symbolic links without using some options. You must choose one of these approaches:
find
command will not follow symbolic links.) ORfind
program that makes it follow symbolic links while processing the command line arguments. (Hint: RTFM and do not use the -L
option; you will get an error message.) ORmaze
your current directory and then use find
. (A current directory can never be a symbolic link - it must be a real directory.)In this maze, use a single command to recursively find the three files with a 12-character basename that looks similar to “abcd0001-txt
” but where the eight-character “abcd0001
” part of the name is replaced by your own account userid. You must use a single command that finds files by basename to find these 12-character file names. Do not try to use “cd
” and “ls
” to find the file in the maze; the maze is very big.
When you have found your three personal “abcd0001-txt
” files in the maze, determine which file is not empty. Only one of the three files is not empty. (Hint: You can combine this step with the previous step if you remember how to search for files greater than zero size.)
Copy the non-empty file from the maze into your assignment03
directory you created above. Read the file to make sure it is the right one (not empty) after you copy it.
Run the Checking Program to verify your work so far.
As mentioned in Lab Worksheet #03 HTML, choose which command you use depending on whether special characters are being used in the search string.
Search for lines containing your login userid in the password file and redirect the output into file me.txt
under assignment03
. You should find exactly one line.
Search for lines containing the special character dollar sign (“$
”) in the file bash.bashrc
in the Source Directory and redirect the output into file dollar.txt
under assignment03
. The word count of this file must be: 3 25 143
.
Run the command last
to display the login times and, in the output of that command, search for lines that do not contain the string pts
. Redirect the output into file reboots.txt
under assignment03
. The word count of this file will be about 7 or 8 lines, maybe a few more. Almost all the lines will start with reboot
.
That is all the tasks you need to do. Verify your word counts and then mark your work:
Summary: Do some tasks, then run the checking program to verify your work as you go. You can run the checking program as often as you want. When you have the best mark, upload the marks file to Blackboard.
There is a Checking Program named assignment03check
in the Source Directory on the CLS. You can execute this program by typing its (long) pathname into the shell:
$ ~idallen/cst8207/13w/assignment03/assignment03check
Execute the above “check” program. This program will check your work, assign you a mark, and display the output on your screen. (You may want to paginate the long output so you can read all of it.)
You may run the “check” program as many times as you wish, to correct mistakes and get the best mark. Some tasks sections require you to finish the whole section before running the checking program at the end; you may not always be able to run the checking program successfully after every single task step.
When you are done with checking this assignment, and you like what you see on your screen, redirect the output of the Checking Program into the text file assignment03.txt
under your assignment03
directory. Use the exact name assignment03.txt
in your assignment03
directory. You only get one chance to get the name correct. Case (upper/lower case letters) matters. Be absolutely accurate, as if your marks depended on it. Do not edit the file.
Transfer the above assignment03.txt
file from the CLS to your local computer and verify its contents. Do not edit this file! No empty files, please! Edited or damaged files will not be marked. You may want to refer to your File Transfer notes.
Submit the assignment03.txt
file under the correct Assignment area on Blackboard (with the exact name) before the due date. Upload the file via the assignment03 “Upload Assignment” facility in Blackboard: click on the underlined assignment03 link in Blackboard. Use “Attach File” and “Submit” to upload your plain text file.
No word-processor documents. Do not send email. Use only “Attach File”. Do not enter any text into the Submission or Comments boxes on Blackboard; I do not read them. Use only the “Attach File” section followed by the Submit button. (If you want to send me comments about your assignment, use email.)
Your instructor may also mark the assignment03
directory in your CLS account after the due date. Leave everything there on the CLS. Do not delete any assignment work from the CLS until after the term is over!
Use the exact file name given above. Upload only one single file of plain text, not HTML, not MSWord. No fonts, no word-processing. Plain text only.
Did I mention that the format is plain text (suitable for VIM/Nano/Pico/Gedit or Notepad)?
NO EMAIL, WORD PROCESSOR, PDF, RTF, or HTML DOCUMENTS ACCEPTED.
No marks are awarded for submitting under the wrong assignment number or for using the wrong file name. Use the exact name given above.
WARNING: Some inattentive students don’t read all these words. Don’t make that mistake! Be exact.
READ ALL THE WORDS. OH PLEASE, PLEASE, PLEASE READ ALL THE WORDS!