Name:

Date:



Lab 2 – Navigating the Unix File System

Introduction

Due

Worth

Lab Steps

Step 1 – Creating a Unix file structure

  1. Log in to your CS department Unix account following these instructions.
  2. Create the following Unix structure in your home directory

    CHALLENGE: Do NOT use the cd (change directory) command in this lab.
    Specify all paths relative to your home directory.



    To create a directory, use the mkdir command. To create a file, use the editor emacs. For example, to create the file concat.c in the directory strings (assuming that you have already created the directory structure), type in

        emacs ~/systems/strings/concat.c
    The contents of the file are not important for this exercise, so simply type in any string you want (for example, “This is the file concat.c”), then save it with Ctrl-x Ctrl-s and hit Enter, then Ctrl-x Ctrl-c to exit. To cancel a partially typed or accidental command, use Ctrl-g.

    To make sure that the file has been created, display the contents of the strings directory

        ls ~/systems/strings/
    You should see the name of the file listed. To display the file contents, use
        less ~/systems/strings/concat.c

  3. Use the ls command multiple times to verify that you have created the correct structure. Alternately, you can type in the Unix command
        find ~/systems -print
    
    to print out the tree structure you have created in your home directory.
  4. Report success or failure to the instructor and have the instructor or TA initial here: _______
  5. ALTERNATIVE TO INITIALS: If you work through this tutorial on your own, briefly describe here in writing what you did and what you learned:

Step 2 – Modifying the Unix file structure

  1. Make a copy of the entire file structure you created in step 1, so you can revert to it in case you accidentally delete something:
        cp -r ~/systems ~/systemscopy
    In the following refer to the original copy your file structure (the one depicted above).
  2. What is the path to projects relative to your home directory?
  3. What is the path to pointers relative to your home directory?
  4. Make a copy of the pointers directory under the projects directory.
  5. Make a copy of the overflow directory under the systems directory, then delete the original copy.
  6. Move the file tutorial.html in the memory directory.
  7. Copy the file stack.c in your home directory and rename it hello.c
  8. Remove the strings directory (and its contents).
  9. Rename blocks.txt to blocks.mm




  10. The new directory structure should be as shown above. Use multiple ls commands to verify it, or type in a single command
        find ~/systems -print
    
    to see the entire tree structure rooted at systems.
  11. Report success or failure to the instructor and have the instructor or TA initial here: _______

  12. ALTERNATIVE TO INITIALS: If you work through this tutorial on your own, briefly describe here in writing what you did and what you learned: