Sobell Exercises, Ch apter 4
1. How are directories different from ordinary files?
2. Determine whether each of the following is an absolute pathname, a relative pathname, or a simple filename:
3. Should you ordinarily start your filenames with period (.)? Why or why not?
4. List the commands you can use to:
a. make your home directory the working directory
b. identify the working directory
5. If your working directory is /home/alex/literature, what two different commands can you use to create a subdirectory called classics?
6. What sequence of commands can you use to remove a directory called /home/jenny/temp and all its contents?
7*. Is the to_do file below a directory or an ordinary file? Do members of the pubs group have permission to read the file?
$ ls -l to_do
-rw-r--r-- 1 alex pubs 1338 May 24 17:01 to_do
What command can Alex use to give everyone permission to write to the file? What will the ls -l command display after Alex does so?
8*. What does it mean to have execute permission for a directory?
9. Suppose you have a file named andor in the current directory. What happens if you run the following commandline?$ mv andor and\/or
10. Create a file called -x in an empty directory. Explain what happens when you try to rename it. How can you rename it?
11*. If /home/jenny/draft is linked to /home/alex/letter, and Alex changes letter, will Jenny see the changes when she looks at draft? What should Jenny do if she does not want Alexs changes to letter to affect draft?
12*. If /home/jenny/draft and /home/alex/letter are links to the same file and the following sequence of events occurs, what will the date be in the opening of the letter?
a. Alex gives the command vi letter
b. Jenny gives the command vi draft
c. Jenny changes the date in the opening of the letter to January 31, 1994, and exits from vi with the ZZ command.
d. Alex changes the date to February 1, 1994 and exits from vi with the ZZ command.
13*. What problems do you run into with multiple writable links to a file?
14. Given the directory structure shown below (figure 4-3) and the following permissions:
d--x--x--x 3 jenny pubs 512 May 15 10:01 correspondence/business
drwxr-xr-x 3 jenny pubs 512 May 15 10:01 correspondence/business/milk_co
What happens when you run each of the following commands? (Assume the files cheese_co, letter_1, and letter_2 are readable by everyone.)
a. cd correspondence/business/milk_co
b. ls -l correspondence/business
c. cat correspondence/business/cheese_co