Lab Exercise on Unix

This exercise is based on the commands you have learned in this lab and the directory structure presented in Figure 1. i.e.:


Assume that you get started from your home directory; that is, when you do an ls , following is what you see:
         labs/        mail/         temp/
Please also remember: the following questions should be regarded as a continuous process; that is, the directory you end up in for question n is what you start from for question n+1.
Pretend that all of the files and directories exist.

  1. What command would you enter to change to directory test2.
  2. While you are in test2, how would you change to test1?
  3. How would you change to lab1 from test1?
  4. Suppose there is a file oneD.cpp in the lab1 directory. How would you make a copy of it with the name oneD.bak?
  5. How would you copy oneD.bak to test1/?
  6. How would you rename oneD.cpp to oneDim.cpp?
  7. How would you change the permission of oneDim.cpp so that it could be read and written by owner (you) and readable by group and world?
  8. How would you change the permission of the lab1 directory so that its permission is
    drwxr-x---
    (Hint: you would have to change to the directory labs/)

Now, actually create some directories in your account. Make a directory called labs, and inside that directory, create directories for ex1, ex2, and ex3. Move your lab exercise C++ files into the appropriate directories. Move to your labs/ex3 directory before you proceed with the next part of this exercise.

Consult with your lab instructor if you have a problem with any of this.