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. You need to be comfortable creating and moving around in directories in a Unix environment. If you don't organize your files, finding a particular file can become a nightmare. The first part of the lab exercise gives you practice with the Unix commands you need to do this. Assume that you get started from your home directory; that is, when you do an ls , following is what you see:
         test.txt        hello.cpp         cs110/ or cs130/
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 lab2.
  2. While you are in lab2, how would you change to lab3?
  3. How would you change to assignment1 from lab3?
  4. Suppose there is a file oneD.cpp in the assignment1 directory. How would you make a copy of it with the name oneD.bak?
  5. How would you copy oneD.bak to ~/?
  6. How would you rename oneD.cpp to oneDim.cpp ?

Now, change to the directory of lab3 and inside that directory, create directories for ex1, ex2, and ex3 for practicing unix commands such as rm and rmdir. Move to your lab3 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.

This page last modified:
Thursday, 06-Oct-2011 12:13:32 CST
Accessed     times.

CS Dept Home Page
CS Dept Class Files
CS110-130 Class Files

Copyright: Department of Computer Science, University of Regina.