Review Exercise 2
Sobell, Chapter 3 (pg 72-73)
Sobell, Chapter 4 (pg 99-101)
Due Date: 1/25/02


Please complete the following Review Exercises.
Place your answers underneath each question using a
Unix text editor.  Turn in your answers as follows: turnin ex2 exercise2.txt 

1. What commands can you use to determine who is logged in on a specific terminal?

	who
	whoami
	who am i
	finger
	w

2. How can you keep other users from using write to communicate with you?

	mesg n

3. What happens if you give the following commands when the file 'done' already exists?
    $ cp to_do done
		'done' is overwritten with contents of 'to_do'
    $ mv to_do done
		'done' is overwritten with contents of 'to_do'
		'to_do' no longer exists after the command

4. How can you find out which utilities are available on your system for editing files?

	apropos edit
   man -k edit

5. What is the result of giving the 'which' utility the name of a command
   that resides in a directory that is not in your search path?

	command not found

6. Experiment by calling the 'file' utility with names of files in /usr/bin.
   How many different types of files can you find there?

	file /usr/bin/* | awk -F: '{print $2}' | sort -u
	9 different file types

7. Find an existing file, or create a file, that:
     a.  compresses by more than 80 percent

		make a file containing all spaces, gzip it

     a.  compresses by less than 10 percent

		GIF files usually don't compress much

   Use ls -l to determine the sizes of the files in question.

	ls -l hotnasa.gif.gz

8. How are directories different from ordinary files?  How can they
   be distinguished using the ls utility?

	Directories are similar to files in Unix, however, they can contain
   other directories and files.

	ls -l
	will display the long file listing, directories begin with a letter 'd'
	ls -l ~ray/trash

	drwxrwxr-x   4 ray          3584 Nov 22 09:39 accum_map_greenland/
	drwxrwxr-x   2 ray          1536 Sep 23  1999 bert/
	drwxrwxr-x   2 ray          1536 Jan  7  1999 epstool/
	-rwxrwxrwx   1 h597         3059 Nov 27 09:56 exercise1.html*
	-rwxrwxrwx   1 h597         2056 Nov 27 10:36 exercise2.html*


9. Is each of the following an absolute pathname, a relative pathname, or
   a simple filename?

   a. milk_co
		simple filename

   b. correspond/business/milk_co
		relative pathname

   c. /home/alex
		absolute pathname

   d. /home/alex/literature/promo
		absolute pathname

   e. ..
		relative pathname

   f. letter.0610
		simple filename

10. Create a file named -x in an empty directory.  Explain what happens
    when you try to rename it.  How can you rename it?  How can you
    delete it?


	touch -- -x   # create it
	mv -- -x -y   # rename it to -y
	rm -- -y      $ remove -y