Set 2
Home Up Introduction Set 1 Set 2 Set 3 Set 4 Set 5 Set 6 Set 7 Set 8 Set 9 Set 10 Set 11

 

Commands, Utilities, and pathnames

Due: end of Friday lab

"Review questions" refers to the review questions at the back of each chapter in the textbook. Unless stated otherwise, "all questions" means "all review questions, including the advanced review questions".

The printed answers to this problem set must be submitted to your lab instructor at the end of your lab period on Friday.  You may use any text editor or word processor you like to create the printed copy.  Your instructor can show you some basic Unix GUI editors and how to print from each editor.

Chapter 3

Read Chapter 3 and answer these questions:

  1. Review questions: all
  2. What is the difference, if any, between these Unix pathnames?
    Could they refer to different files?
  3. .profile
    ./.profile
    ././././.profile 
  4. If "data" is a subdirectory of the current directory, then what are the
    differences, if any, among the following commands?
  5. $ ls data/..
    $ ls .
    $ ls
  6. If you were to change your PATH environment variable to contain the following imaginary directory names:

    $ PATH=/happy/groundhog/day:/recycling/rules

    In which directories would the shell look for the imaginary "zoot" command if you type the following command lines:

    $ zoot
    $ ./zoot
    $ subdirectory/zoot
    $ /sbin/zoot
    $ ../zoot


    For each of the five command lines, give all the possible places the shell would try to find the "zoot" command.
  7. What single Unix commands would you use to:
  8. change to your home directory
    display the list of files in the current directory
    display "my name is fred" onto the screen
    put the file "tmp.dat" in the current directory down into the directory "data" underneath your home directory, leaving a copy behind in your current directory? (Both the current directory and the "data" subdirectory each have a separate copy of the file.)
    put the file "tmp.dat" in the current directory down into the directory "data" underneath your home directory, without leaving a copy behind in your current directory? (After the command, the file will only exist in the "data" subdirectory.)
  9. A Unix user has created a file called "-tmp", with a leading dash.  (The command "cp .profile -tmp" will do it.) They now want to get rid of this file. Why might the user have difficulty removing this file? (Create this file and try it yourself.) How would you remove the file?
  10. How many records are in the Unix password file ("/etc/passwd") on your computer?  (Helpful hint: "man wc".)  How many fields does each record contain?
  11. What is stored in the second field of every record in the Unix password file?

Print and submit your answers to the lab instructor by the given due date and time.