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. CHALLENGE: Do NOT use the

    cd (change directory) command in

    this lab. Specify all paths relative

    to your home directory.

     
    Create the following Unix structure in your home directory


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

pico ~/csc2400/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-O (see the menu at the bottom of the editor window) and hit Enter, then Ctrl-X to exit. To make sure that the file has been created, display the contents of the strings directory

ls ~/csc2400/strings/

You should see the name of the file listed. To display the file contents, use

more ~/csc2400/strings/concat.c

  1. Use the ls command multiple times to verify that you have created the correct structure.
  2. Report success or failure to the instructor and have the instructor or TA initial here: _______
  3. 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 ~/csc2400 ~/csc2400copy

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

 

  1. The new directory structure should be as shown above. Use multiple ls commands to verify it.
  2. Report success or failure to the instructor and have the instructor or TA initial here: _______
  3. ALTERNATIVE TO INITIALS: If you work through this tutorial on your own, briefly describe here in writing what you did and what you learned: