Problems 8
Home Up Review Problems 1 Problems 2 Problems 3 Problems 4 Problems 5 Problems 6 Problems 7 Problems 8 Problems 9 Problems 10 Problems 11 Problems 12 Problems 13 Problems 14 Problems 15 Problems 16 Subnets

 

Symbolic Links


There is an option to the "ls" command that lists the Unix "i-node" number of each file and directory. You will find that option useful in doing this lab.

  1. Directory ~ian/maze/ is owned by ian and has inode number 76891. Show the command line that tells you this, along with its output (cut-and-paste).
  2. Show the command line that can count the amount of disk space used in this directory, along with its output (cut-and-paste).
  3. This directory with inode number 76891 is named "maze". Where is the name "maze" stored? Show the owner and inode number of the place where the name "maze" is stored.
  4. In two columns, give the name and inode number contents of the "maze" directory. Show all the names (including hidden names) and the inode numbers in the directory. Your table will look something like this:
    Directory Inode Number 76891
    Name Inode Number
    somename 123456
    othername 234567
    morename 345678
    ...etc... ...etc...

     

  5. Explain the type of thing to which each inode number points, for example:
    inode number 123456: file containing the text "Hope Springs"
    inode number 234567: symbolic link to "burfl"
    inode number 345678: directory
  6. Write a shell script that creates a directory structure identical to that of ~ian/maze/ in a new directory named "maze" in the current directory of the person running the shell script.  The script will be a set of Unix commands that, when run, will create the directory "maze" and create files, links, and symlinks identical to the structure in ~ian/maze/

    If your shell script were run in the /tmp directory, the script would create /tmp/maze/ and then create the exact set of files, links, and symlinks as found in ~ian/maze/.

    Your script should not copy the contents of ~ian/maze/; it should execute the necessary Unix commands to create an identical directory from scratch.  Do not use Unix commands to simply copy the existing directory.

  7. In the "maze" directory you create:
    Delete the symbolic link name "d" from the directory. Which names in the directory no longer lead to anything useful? Explain.
    Delete the file name "finish" from the directory. Which names in the directory no longer lead to anything useful? Explain.