Updated: 2013-05-08 21:04 EDT

1 Due Date and DeliverablesIndexup to index

WARNING: Some inattentive students upload Assignment #3 into the Assignment #2 upload area. Don’t make that mistake! Be exact.

2 Purpose of this AssignmentIndexup to index

This assignment is based on your weekly Class Notes.

  1. Complete Lab Worksheet #03 ODT.
  2. Execute some simple Linux commands and generate some Linux output.
  3. Find some files. Move some files. Copy some files.
  4. Transfer and submit a file to Blackboard.

Remember to READ ALL THE WORDS to work effectively and not waste time.

3 Introduction and OverviewIndexup to index

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.

4 TasksIndexup to index

4.1 The Source DirectoryIndexup to index

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.

4.2 Worksheet and PromptIndexup to index

  1. Do the Lab Worksheet #03 ODT before this assignment. Record all your answers for later quizzes.

  2. 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!

  3. 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.

4.3 Working with directories and filesIndexup to index

  1. 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.

  2. 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.

  3. 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.

  4. 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.)

  5. 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.)

  6. 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.

  7. 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.

  8. 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!)

  9. 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.

  10. 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

  11. 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.

4.4 Finding multiple files in a mazeIndexup to index

  1. Under the Source Directory there is a symbolic link named “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:
    1. Use the maze pathname from the previous assignment, not the pathname in the Source Directory that is the symbolic link. (The find command will not follow symbolic links.) OR
    2. Use an option to the find 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.) OR
    3. Make the maze your current directory and then use find. (A current directory can never be a symbolic link - it must be a real directory.)
  2. 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.

  3. 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.)

  4. 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.

4.5 Searching for text inside filesIndexup to index

As mentioned in Lab Worksheet #03 HTML, choose which command you use depending on whether special characters are being used in the search string.

  1. 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.

  2. 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.

  3. 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:

5 Checking, Marking, and Submitting your WorkIndexup to index

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.

  1. 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

  2. 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.

  3. 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.

  4. 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.

  5. 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.)

  6. 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!

Author: 
| Ian! D. Allen  -  idallen@idallen.ca  -  Ottawa, Ontario, Canada
| Home Page: http://idallen.com/   Contact Improv: http://contactimprov.ca/
| College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/
| Defend digital freedom:  http://eff.org/  and have fun:  http://fools.ca/

Plain Text - plain text version of this page in Pandoc Markdown format

Campaign for non-browser-specific HTML   Valid XHTML 1.0 Transitional   Valid CSS!   Creative Commons by nc sa 3.0   Hacker Ideals Emblem   Author Ian! D. Allen