Solution for Exercise 1

Review Exercise 1
Sobell, Chapter 1 (pg 13)
Sobell, Chapter 2 (pg 39)
Due Date: 1/18/02 at 11:00 a.m.


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

1. What is a multiuser system?  What are they successful?

A multiuser system is one that supports many users at one time.
The cost per user is minimized.

2. In what language is Solaris written?  What does the language
   have to do with the success of Unix? 

Solaris is written in C.  C is a very portable language, hence
it can be ported to many different platforms.

3. What is a utility program?

A utility is a command that is universally required by users.
Examples are sort, awk, cp, chmod and ls.

4. What is a shell?

A shell is both a command-interpreter and programming language.
It acts as an interface between the user and the operating system.


5. Why is the Solaris filesystem referred to as a hierarchical (or treelike)
   filesystem?

Files are arranged under directories.  Each directory can hold
other files and directories.  This layer appears as a inverted
tree, with the root at the top.

6. What are the differences between the 'cat' and 'ls' utilities?
   What are the differences between 'pg' or 'more' and 'cat'?

'cat' prints the contents of a file to the screen
'ls' lists out the contents of a director
'pg' similar to more in that is shows a page of output at a time
     however you can back up, e.g. with the ? character
     'pg' waits for you to press RETURN
'more' a filter that displays the contents of a text file one
       screenful at a time
      'more' waits for you to press SPACE


7. Five of the following seven filenames contain special characters:
     "\abc
     "abc"
     'abc'
     ab*c
     !abc
     abc
     -f

   a. Show how to create files with these names. 
   b. Give commands to remove them.

Create them:

touch \"\\abc
touch \"abc\"
touch \'abc\'
touch ab\*c
touch \!abc
touch abc
cat > '-f'  then type control+d   -or- touch -- -f

Remove them:

rm \"\\abc
rm \"abc\"
rm \'abc\'
rm ab\*c
rm \!abc
rm abc
rm - '-f'   -or-  rm -- -f

8. You saw that man pages for 'write' appear in sections 1 and 2 of
   the system manual.  Explain how you can determine what sections of
   the system manual contain a manual page with a given name.

   a. using man

	man -l read
   this will output all the man pages for various versions of read

	man -s 2 write
	this will output the man page for the write command for section 2

9. (a) List the files in the directory /usr/bin in reverse alphabetic
       order using both 'ls' and 'sort'.

	ls /usr/bin | sort -r
	- or -
	ls -r /usr/bin

   (b) Repeat part (a) and pipe the result to 'head' to display only
       the first 4 lines.

	ls /usr/bin | sort -r | head -4

   (c) Repeat part (a) and pipe the result to 'tail' to display all
       but the first 3 lines.

	ls /usr/bin | sort -r | tail +4

10. Determine the total number of files in the /usr/bin directory
    using both 'ls' and 'wc'.

	ls /usr/bin | wc -l 

11. You will receive an email message from user h597.  Reply, incorporating
    the original message.