



   *********************************************************************
   *********************************************************************
   *********************************************************************



                             INTRODUCTION

                                  TO


                    X    X  X    X     X    X    X
                    X    X  XX   X     X     X  X
                    X    X  X X  X     X      XX
                    X    X  X  X X     X      XX
                    X    X  X   XX     X     X  X
                     XXXX   X    X     X    X    X



                        TRAINING COURSE MP-119


                 This textbook was written  specifically  for
                 the  UNIX systems operated by the Department
                 of Defense, and may  contain  references  to
                 features available only on those systems.

   ********************************************************************
   ********************************************************************
   ********************************************************************
















                                                     Mildred M. Ware
                                                             Revised
                                                      Susan Costello
                                                        Thomas Leary
                                                      December, 1979










   MP119                                        Introduction to Unix











                         INTRODUCTION TO UNIX





             uu         uu        nn       nn    iii     ttttttttt
             uu         uu        nnn      nn    iii        ttt
             uu         uu        nn n     nn    iii        ttt
             uu         uu        nn  n    nn    iii        ttt
             uu         uu        nn   n   nn    iii        ttt
             uu         uu        nn    n  nn    iii        ttt
             uuuuuuuuuuuuu        nn     nnnn    iii        ttt


                                      iiiiiii
                                        iii
                                        iii
                                        iii
                                        iii
                                        iii
                                      iiiiiii



               (Gaining access to Unix, inter-user communication,
               file manipulation and utility programs)












                                                     Mildred M. Ware
                                                    December, 2 1979










   MP119                                        Introduction to Unix

                  _T_A_B_L_E _O_F _C_O_N_T_E_N_T_S

                       _U_n_i_t _I


       Preface___________________________________________ i

        A. Introduction to Unit I

          1. What is Unix________________________________ 1
          2. Entering commands___________________________ 1
          3. What's in Unit I____________________________ 2
          4. Objectives for Unit I_______________________ 3

        B. Module I--Gaining access to the system
          Objectives:____________________________________ 4

          1. The terminal________________________________ 5
          2. The keyboard________________________________ 6
          3. Special characters__________________________ 8
          4. Getting started_____________________________ 8
          5. Changing passwords__________________________ 11
          6. Correction characters_______________________ 13
          7. Who command_________________________________ 14
          8. Where command_______________________________ 15
          9. Date command________________________________ 15
         10. Terminal malfunctions_______________________ 17
         11. Module I test_______________________________ 18
         12. Answers to Module I test____________________ 20


       C. Module II--Inter-user communication
          Objectives_____________________________________ 21

          1. Message command_____________________________ 22
             (a) Reading mail____________________________ 22
             (b) Seeking help____________________________ 23
             (c) Using the Message program commands______ 27
             (d) Deleting messages_______________________ 28
             (e) Exiting the Message program_____________ 29
          2. Sending messages
             (a) SNDMSG command__________________________ 33
             (b) Points of interest______________________ 35
          3. Write command_______________________________ 36
          4. Remind command______________________________ 39
          5. Module II test______________________________ 42
          6. Answers to Module II test___________________ 43







                                 - i -






   MP119                                        Introduction to UNIX

      D. Module III__File manipulation

         Objectives______________________________________ 44

          1. What is a file?_____________________________ 45
          2. Creating files______________________________ 47
          3. Displaying files
             (a)Cat command______________________________ 48
             (b)Pr command_______________________________ 49
          4. Printed output
             (a)Opr command______________________________ 52
             (b)Opr as a filter__________________________ 53
          5. Concatenating Files_________________________ 54
          6. Appending information_______________________ 54
          7. Filenames and wild cards____________________ 57
          8. Listing Filenames___________________________ 59
          9. Deleting files______________________________ 62
         10. Comparing files_____________________________ 63
         11. Changing file modes_________________________ 65
         12. Assigning file modes________________________ 67
         13. Determining file privileges_________________ 68
         14. Module III test_____________________________ 70
         15. Answers to Module III test__________________ 71

     E. Module IV__Utility Programs

        Objectives_______________________________________ 72

          1. Searching files_____________________________ 73
          2. Sorting files_______________________________ 76
          3. Segmenting files____________________________ 83
          4. Spell Command_______________________________ 85
          5. Networking__________________________________ 85
          6. Module IV test______________________________ 88
          7. Answers to Module IV test___________________ 89

         Unit I Unix Commands Summary____________________ 90
         Unit I Proficiency Test_________________________ 92















                                - ii -







   MP119                                        Introduction to UNIX


                      _P_r_e_f_a_c_e


        _P_u_r_p_o_s_e


        The purpose of this course is to introduce  the  student  to
   the  Unix  system.  Topics are presented to assist the student in
   learning to use the Unix system to  form  and  format  memoranda,
   documents, letters, and reports.

        The course specifically includes the use of inter-user  com-
   munication  commands, file manipulation commands, directory mani-
   pulation commands, the Rand editor, the UNIX Text editor, Utility
   programs, and NROFF.

        This course is designed for use  specifically  on  the  Unix
   systems  of the Dept. of Defense, and may reference programs that
   are not used on other systems.

        _G_o_a_l


        The student will understand how  to  effectively  and  effi-
   ciently use the Unix system to create, format, edit, and maintain
   text files.  In effect, he or she will gain a basic competence in
   using UNIX.

        _S_e_l_f-_p_a_c_e_d _I_n_s_t_r_u_c_t_i_o_n


        Many differences may be cited regarding self-paced  instruc-
   tion  and  conventional instruction (classroom setting); however,
   the main difference is that you have complete control  over  your
   learning  environment.   You  determine  your hours of study, the
   amount of material to  be  covered  in  a  single  sitting,  when
   another  topic should be introduced, etc..  In other other words,
   you set the pace of your instruction.

        There are still more goodies; you  no  longer  have  to  sit
   through  boring lectures covering things you already know, or try
   to learn something new before you have a firm grasp of  the  last
   topic  discussed.  You will also know exactly what is expected of
   you because at the beginning of each lesson will  be  a  list  of
   objectives  which  specify  the  things  you should be able to do
   after completing the lesson.  Also,  practical  exercises  follow
   each lesson to let you know just how well you are doing---no more
   guessing.




                                - iii -







   MP119                                        Introduction to UNIX

        _H_o_w _t_h_e _c_o_u_r_s_e _i_s _o_r_g_a_n_i_z_e_d


        _U_n_i_t_s


        The course is divided into 4 units.  Each  unit  presents  a
   major  phase  of instruction, and each is an independent block of
   instruction with the exception of unit I, ie. the  units  do  not
   have to be studied sequentially.


        _M_o_d_u_l_e_s


        A unit is divided into several lessons called modules.  Each
   module covers one or more unit objectives, and is further divided
   into sections covering a specific topic. At the end of each  sec-
   tion  are exercises to be performed at the terminal to re-enforce
   the previously discussed topic. Be sure to do these exercises  as
   doing  them is essential if you are to learn the material. At the
   end of each module is a test covering  the  objectives  for  that
   module. The module tests are self-administered and self-scored.

        _U_n_i_t _P_r_o_f_i_c_i_e_n_c_y _T_e_s_t


        This test covers the objectives stated at the  beginning  of
   the  unit, and is self-administered; however, it is graded by the
   instructor. After completing the test,  you  should  contact  the
   instructor to have your test graded and to discuss your progress.

        _F_i_n_a_l _E_x_a_m


        The final exam will cover material discussed in all 4 units.
   In  a conventional course, this is a time to be dreaded; however,
   in a self-paced course such as  this,  all  anxieties  are  elim-
   inated.   You  will  know  exactly what things to review. How? By
   looking over the objectives stated at the beginning of each unit.

        _G_r_a_d_e_s


        A grade of P or F will be given.  To receive a P,  you  must
   demonstrate  that you have mastered the material presented in the
   course by achieving at least a 70 on the final exam.





                                - iv -








   MP119                                        Introduction to UNIX

        _N_o_t_a_t_i_o_n


        The following notation is used in forming commands to  indi-
   cate that the enclosed word/words (argument) is to be replaced by
   a value as indicated by the enclosed word/words.

     _s_y_m_b_o_l               _m_e_a_n_i_n_g
           [ ]               Use of  this  argument  is  optional---
                             isn't required to form the command.
           ( ) or < >        Use  of  this  argument  or  option  is
                             required in forming the command.


         _O_t_h_e_r _N_o_t_a_t_i_o_n

        Type:         You are to type the characters that follow.

        Response      A message displayed by the system.

        _U_n_i_x _A_c_c_o_u_n_t


        Do you have an account on the Unix system?  If not,  contact
   the  operations  people on your local UNIX system.  You must have
   an account on a UNIX system before beginning this  course.  Also,
   it  is  necessary  for you to have this course to effectively use
   the system.

        _R_e_f_e_r_e_n_c_e_s


        There are several information bulletins and manuals  on  the
   Unix  System  which  may  be  obtained  by contacting the systems
   manager. You should have received the following  items  when  you
   obtained your UNIX account:
      []   Documents for the PWB/UNIX Time Sharing System
      []   PWB/UNIX User's Manual, Edition 1.0
      []   UNIX Reference Card
      []   Supplement to PWB/UNIX Manual
      []   Information Guide for UNIX

   Notes: (1) You are not expected to sit down  and  read  all  this
              material.   It  is  the definitive word on UNIX and is
              intended primarily for purposes of reference.  As  you
              progress you will find that reading some of the manual
              pages might help. Also, reading the UNIX documents can
              help you expand your knowledge of particular points.
          (2) A warning concerning  the  UNIX  documentation  is  in
              order.   The material is extremely concise. This means
              that it must be read very slowly and carefully. Things

                                 - v -








   MP119                                        Introduction to UNIX

              are  mentioned  only  once  and in many cases they are
              mentioned  rather  obscurely.  It  is  precisely  this
              feature  of  the manuals that makes MP119 so useful to
              the new user.
          (3) One more point to keep in mind is the  fact  that  the
              course cannot serve as a substitute for the UNIX docu-
              mentation. Once you finish the course you will not  be
              a  UNIX  expert.  We  are  unable to cover everything.
              Much useful material has been left out. Even with  the
              subjects taught we have had to skip many items. Natur-
              ally, you are encouraged to refer to  the  manuals  to
              expand your knowledge of particular points.

        _A_d_d_i_t_i_o_n_a_l _S_o_u_r_c_e_s


        As was mentioned above, the material which is  presented  in
   MP119  is  only  an overview of the facilities that are currently
   available on the UNIX system. For information concerning the more
   esoteric  and  less  widely  used aspects of the system, one must
   consult the various manual sources.

        On the topic of the UNIX Editor, two sources  are  currently
   available:  "A Tutorial Introduction to the UNIX Text Editor" and
   "Advanced Editing on UNIX." Both are included  in  _D_o_c_u_m_e_n_t_s  _f_o_r
   _t_h_e  _P_W_B/_U_N_I_X  _T_i_m_e  _S_h_a_r_i_n_g _S_y_s_t_e_m (sections B.3 and B.4 respec-
   tively).

        For additional information on NROFF and the NM macro package
   consult  the  following  sources: "NROFF/TROFF User's Manual," "A
   TROFF Tutorial," "MNM-Macros for Formatting  Informal  Documents"
   and   "User's   Guide   to   the  'NM'  Macros"(PIB-78-006).  The
   NROFF/TROFF items can be found in the _D_o_c_u_m_e_n_t_s.   The  first  of
   the  macro  items  mentioned  above  forms a part of the _P_W_B/_U_N_I_X
   _U_s_e_r'_s _M_a_n_u_a_l (Supplement, section 7, MNM [VII], pp.  1-6).   The
   "User's  Guide" is on line, a copy can be obtained from your UNIX
   system administrator. One more item of interest concerning  NROFF
   is  the  relevant  section  in the _P_W_B/_U_N_I_X _U_s_e_r'_s _M_a_n_u_a_l (listed
   alphabetically in section 1 - PWB/UNIX  I).   Finally,  for  more
   information  on  the  Rand Editor consult the following: "The CRT
   Text Editor NED - Introduction and Reference Manual."

        A few comments on the organization of  the  _P_W_B/_U_N_I_X  _U_s_e_r'_s
   _M_a_n_u_a_l  would  appear  to  be  in  order.  The "User's Manual" is
   divided into the following eight sections:

              I.  Commands and Application Programs

             II.  System Calls



                                - vi -








   MP119                                        Introduction to UNIX

            III.  Subroutines

             IV.  Special Files

              V.  File Formats and Conventions

             VI.  Games

            VII.  Miscellaneous

           VIII.  System Maintenance

   Each of these sections consists of a number of entries of several
   pages in length. Within each section entries are organized alpha-
   betically according to entry name, which  appears  in  the  upper
   right-hand corner.  Supplements to the manual are integrated into
   the proper section.



































                                - vii -








   MP119                                        Introduction to UNIX

                   _I_n_t_r_o_d_u_c_t_i_o_n _t_o _U_N_I_T _I

        _W_h_a_t _i_s _U_N_I_X?


        UNIX is a general-purpose, multi-user, interactive operating
   system  for  the  Digital  Equipment Corporation (DEC) PDP 11/40,
   11/45, 11/70, VAX-11/780 computers.  It was  initially   designed
   as  a text editing and formatting system.

        UNIX was developed by Bell Laboratories in 1969; however the
   later  version  which  is  implemented  here,  at the Agency, was
   revised in February 1971. As a result of this revision,  Unix  is
   presently  a  system  of  many unique capabilities. It contains a
   number of features seldom offered even in  much  larger  systems,
   such as:


   o+  it allows use of upper and lower-case characters  as  well  as
     special characters in the formation of file names.

   o+  files are created directly at the terminal  with  very  little
     effort.

   o+  it allows a file to be created by alternate methods.

   o+  it has several facilities which may be used to edit a file.

   o+  it performs many functions by just using  a  few  keys  rather
     than having to type a complete input line.

   o+  it has a  symbolic command language that is easy to use

        There are many other unique features which could  be  cited;
   however,  we  hope  you will find that the most important charac-
   teristics of UNIX are the simplicity, elegance, and ease of use.

        Our primary utilization of UNIX will be the preparation  and
   formatting of documents and textual materials.

        _E_n_t_e_r_i_n_g _c_o_m_m_a_n_d_s


        To communicate with Unix, a command language is  used;  that
   is,  when some desired action is to be performed, such as: creat-
   ing a file, displaying a file, editing a  file,  etc.,  the  user
   must  type  a  command  which  prompts the system to perform this
   action.




                                 - 1 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix

        A command to be entered has a predefined name and  a  prede-
   fined  meaning,  and  must  be  entered  exactly  as  it has been
   defined. Otherwise, the system doesn't recognize  that  it  is  a
   command  and  will  generate  an error.  For example, suppose you
   wanted to execute the WHO command, but you  typed  WHOM  instead.
   WHOM would not be recognized as a command; consequently, the sys-
   tem would respond with ----- WHOM:not found

        _W_h_a_t'_s _i_n _U_n_i_t _I?


        This unit discusses how to gain access to the  Unix  system,
   communicate with other users, and manipulate files.

        In module 1, you will learn to  use  the  SuperBee  model  2
   and/or  the Delta Data 7000 terminal to communicate with the sys-
   tem.  Topics  discussed  include  Login  and  Logout  procedures,
   changing  passwords,  keyboard  functions,  and  error correction
   methods.

        In module 2, you will learn to communicate with other  users
   via the terminal.

        In module 3, you will learn to  perform  file  manipulation.
   Creating,  listing,  concatenating,  comparing,  displaying,  and
   deleting files will be discussed. Changing file modes and obtain-
   ing printed copies will also be covered.

        In module 4, you will learn  to  use  several  miscellaneous
   commands to enhance file manipulation.






















                                 - 2 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


                       _O_b_j_e_c_t_i_v_e_s  _f_o_r _U_N_I_T _I


        When you have completed this unit, you will be able to:

    1.  Perform the procedures necessary to gain access to the  UNIX
        system.

    2.  Correct mistakes in an input line before it is entered.

    3.  Utilize the "Who," "Where," and "Date" commands.

    4.  Communicate with other users by sending messages.

    5.  Create and display files.

    6.  Determine the names of your existing files.

    7.  Obtain a printed copy of a file.

    8.  Copy and delete files.

    9.  Compare files to determine which lines of text are the  same
        or different.

   10.  Change the mode of a file.

   11.  Utilize the "Grep," "Split," and "Sort" commands.

        If you have had some experience with  the  system  and  feel
   that you can already fulfill the objectives stated above, you may
   take the Unit I examination at the end of this unit  and  proceed
   to unit II.

        This approach may be also taken with the individual modules,
   that  is,  if  you are confident that you know the material to be
   presented in a module, then take the test at the end of that par-
   ticular module and continue to the next module.













                                 - 3 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


        _M_o_d_u_l_e _I ---  _G_a_i_n_i_n_g _A_c_c_e_s_s _t_o _t_h_e _S_y_s_t_e_m


        This module covers unit I objectives 1, 2 and  3.

        _O_b_j_e_c_t_i_v_e_s


        Upon completion of this module you will be able to

    1.  Perform the start-up procedure  used to place a terminal  in
        an on-line status.

    2.  Explain the function of the RUBOUT and RETURN keys

    3.  Explain the significance of the (%) symbol.

    4.  Gain access to the UNIX system by using the Login procedure.

    5.  Make corrections to a line before it is entered.

    6.  Change your password.

    7.  Determine who is on the system.

    8.  Display the current date and time.

    9.  Determine terminal locations.

   10.  State the action to be taken in case  of  terminal  malfunc-
        tion.




















                                 - 4 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


        _T_h_e _t_e_r_m_i_n_a_l


        The terminal you will be using will depend upon  the  system
   on  which you have an account.  The UNIX operating system is used
   primarily with three different terminals.  The older UNIX  confi-
   gurations use either Superbee or Hewlett-Packard terminals, newer
   systems are equipped the Delta Data 7000 terminals.  Check  right
   now  to  see  which  terminal you are using.  It shouldn't be too
   hard to find the company name somewhere  on  the  terminal.   The
   differences between the terminals is not terribly great, but some
   keys have different names, a few commands are slightly different,
   and  of  course  each  brand  of  terminal has its own particular
   idiosyncracies.  Feel free to ignore any of  the  material  which
   does  not  deal  with  the terminal you are using, but you should
   glance through it as you may have to use a different kind of ter-
   minal later on.

        The terminals do  share  some  common  features.   At  least
   twenty-five  lines  of  data may be placed on the display screen,
   henceforth referred to as a page.  Each line consists of 80 input
   positions, that is, up to 80 characters may be placed on a line.

        You should be seated in front of a  terminal  now.  If  not,
   your  first task will be to locate an available terminal.  If you
   cannot find a free one, ask some kind soul who is logged  in,  to
   type  "where  tty."   This  command  will  direct you to the room
   numbers of other terminals hooked up to your system.























                                 - 5 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


        _T_h_e _K_e_y_b_o_a_r_d


        Let's pause for a moment to discuss the keyboard before con-
   tinuing with the login procedure.

        The keyboard appears to be just like any ordinary typewriter
   with the exception of a few keys. These keys are used for special
   functions. Let's take a look at them now. Locate each key  as  we
   go along.

   _K_e_y               _M_e_a_n_i_n_g
   RETURN            Information you type is sent  to  the  computer
                     one  line  at  a  time.   When  you depress the
                     RETURN key, the entire line on which the cursor
                     (-) appears will be input to the computer.
                     Note: 1. Each time the RETURN key is depressed,
                              the  cursor  advances to the beginning
                              of the next line. The RETURN key is to
                              be   depressed  following  each  input
                              line.
                           2. The screen will automatically  advance
                              to  the  next  line  when  end  of the
                              current line is reached and the RETURN
                              key  hasn't  been  depressed; however,
                              this  could  cause  trouble  later  in
                              editing  because each physical line no
                              longer represents a logical line.

                     Definition:  physical  line---  An  input  line
                     occupying up to 80 characters.

                     Definition: logical line --- may consist of one
                     or  several  physical  lines  and terminated by
                     depression of the RETURN key.

   RUBOUT or DEL     Input from the RUBOUT or DEL  key  has  special
                     meaning  to  the  RAND  editor and will be dis-
                     cussed later; however, when not using the  edi-
                     tor  it  is  used  as an interrupt or attention
                     signal; i.e., it is used to notify a program to
                     stop  executing  or  to  abort a command. It is
                     typically used to stop a long printout that you
                     don't want.







                                 - 6 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix

   SHIFT             Changes the keyboard from lower-case to  upper-
                     case   characters.   A  word  of  caution  ----
                     Although  the  system  recognizes  and  accepts
                     upper  and  lower-case  characters,  it makes a
                     distinction between the two; i.e., "A" and  "a"
                     are  two different characters. All commands and
                     login names are entered in lower-case letters.

   *CLEAR            Erases the screen and positions the  cursor  at
                     the  upper-left side of the screen.  Note: This
                     takes the terminal out of the input mode, which
                     allows commands to be entered. You must hit the
                     RETURN key to return to the input mode.

   *SCROLL UP        Advances  the  screen  one  line  at  at  time.
                     Several  lines  may  be  advanced  by continual
                     depression of the key.

   *SCROLL DOWN      Same as SCROLL UP except screen moves downward.

   *NEXT PAGE        Advances to the next page. similar to using the
                     SCROLL  UP key except this advances a full page
                     with one stroke instead of a single line.

   *PREV PAGE        Displays the previous page.  Similar  to  using
                     the SCROLL DOWN key.

   TAB               Causes the  cursor to be advanced to  the  next
                     tab  stop.  A  tab  stop  is every 8 positions,
                     beginning with position 1, e.g., 1, 9, 17,  25,
                     etc.

   CTRL-D            Is formed by depressing the 'CTRL' key and  the
                     'D'  key.  It  is  used  to signify the  end of
                     transmission; however, it does  not  cause  the
                     execution  of a command to be terminated as the
                     RUBOUT key does.















                                 - 7 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix

   Notes: 1. Use only the keys mentioned above.  The other  keys  on
          the  console  also  have  special  functions,  and  if you
          depress the wrong key, you will  cause  your  terminal  to
          become inoperable.  So, DON'T TOUCH!!
          2. Page and screen are used synonymously.
          3. Attention you  Superbee  users!   Never  use  the  keys
          marked  "*"  in the "online" mode. Before using them press
          the POWER/RESET key. After using one  of  these  keys  and
          before continuing use of UNIX, press the "online" key.

        _E_x_e_r_c_i_s_e


        Take some time now to study the  function  of  each  of  the
   keys, as I expect you to be able to recall this information after
   completing the module.  Suggestion: Cover the meaning and try  to
   state  in  writing  what each key does. Then, uncover the meaning
   and check your statement.

        _S_p_e_c_i_a_l _C_h_a_r_a_c_t_e_r_s _o_n _t_h_e _S_c_r_e_e_n

   _C_h_a_r_a_c_t_e_r         _M_e_a_n_i_n_g
         %           This is a prompt indicating that the system  is
                     ready to accept another command. This symbol is
                     referred to as the "prompt" symbol, and is gen-
                     erated  when the RUBOUT key and then the RETURN
                     key are depressed.

         _           This is called a cursor,  It's  the  underscore
                     and points to the next input position or to the
                     place where the next character  you  type  will
                     appear.  On  the  Delta  Data  the  cursor will
                     appear as a large square block.,


   Note: If the prompt (%)  appears  somewhere  other  than  at  the
         beginning  of  a line, don't be concerned. Unix is going to
         accept only the command or that portion of the  input  line
         appearing to the right of the prompt.

        _G_e_t_t_i_n_g _s_t_a_r_t_e_d


        You are now ready to begin, if you  are  using  a   Superbee
   terminal, check to see that it has been turned on. If it has not,
   there is a switch located in the  back  on  the  lower  left-hand
   side, flick it up. Now, at the very top of the keyboard, you will
   see an on-line button.  Press it. This places your  terminal  on-
   line  or  in  communication with the computer. If you are using a
   Delta Data terminal and it is not turned on you must go through a
   procedure  called  "down-line loading." A set of instructions for

                                 - 8 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix

   down-line loading should be posted somewhere in the  vicinity  of
   the terminal.

        _L_o_g_i_n _p_r_o_c_e_d_u_r_e


        Check to see whether the word login:  is  displayed  on  the
   screen.  If  it  isn't,  depress  the BREAK key, then depress the
   RETURN key.  One of  the  following  should  now  appear  on  the
   screen.
                         login:
                         login incorrect:

        Type the login name you were assigned and  don't  forget  to
   depress the RETURN key. Remember, this causes the information you
   type to be entered into the computer.

        You will notice that your login name was probably formed  by
   using the initials of your name; this is to obtain a unique name.
   Your account or login name identifies you as a legitimate user of
   the system.

        The system will now display:

                         Password:

        This is a prompt to you to enter  your  password.  Don't  be
   alarmed  when  the system doesn't display the password you typed.
   Everything's ok, it has been designed this way to  prevent  unau-
   thorized persons from seeing the password you typed.

        The system will now verify the login name and  password  you
   entered.  If both are valid, it will allow you access to the UNIX
   system. This is determined by the presence of the prompt  charac-
   ter (%). (The system may also display other things first, such as
   the message of the day. This is a message to all users  from  the
   systems people.)

        If you receive a response such  as  "no  directory,"  notify
   operations.  If you receive a response of "Permission denied," it
   means that you are not authorized to use that  particular  termi-
   nal.   Try  another  terminal  or  ask  operations  or the system
   administrator give you access rights to use that particular  ter-
   minal. (That is assuming you should be allowed to use that termi-
   nal.)







                                 - 9 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix

        _E_x_a_m_p_l_e _o_f _t_h_e _l_o_g_i_n _p_r_o_c_e_d_u_r_e:

   You should see the following three lines displayed on the screen:
                  DODKINS -- PWB/UNIX 1.0
                  login:

   You would now type your login name

             mmw             {login name entered in lower case}

             Password:       {you would now enter your password}

   Remember, it isn't displayed -- if you haven't made any   errors,
   the  system  will respond by displaying the date and time of your
   most recent login followed by a  bunch  of  stuff  and  then  the
   prompt character:

             Previous login: Tue Nov 6 13:11:40 1979
             <several lines of text>
             %

        The system is now ready to accept a  command   to  create  a
   file, or display a file, or execute a utility program, etc.  How-
   ever, before we discuss how to do any of these, let's look  at  a
   few other essential topics.

        _T_h_e _l_o_g_i_n _C_o_m_m_a_n_d


        A login command is also provided for your use.  It  has  the
   following form.

                         login <login-name>

        This command is used when you have access to more  than  one
   login  name.   Suppose you and someone else have been assigned to
   the same project and will have to reference each  other's  files.
   Consequently,  you  should be able to log in under his login-name
   and he under yours.

        Now, let's assume that you are logged in under  your  login-
   name  and  you  want to switch to his.  How can this be achieved?
   Well, you could log out and  then  perform  the  login  procedure
   again, or you can simply enter the login command.








                                - 10 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


        _I_n_c_o_r_r_e_c_t _l_o_g_i_n


        If the system displays the message:

                         login incorrect:

   instead of the the current date and the prompt,  you  have  typed
   either  your  account  name  or your password incorrectly; conse-
   quently, the system won't allow you access to UNIX. You must per-
   form  the  login  procedure again, beginning with the entering of
   your login name. If you cannot provide a correct login  name  and
   password  in  several  tries  the system security officer will be
   notified. Don't worry, this is to prevent people from  trying  to
   break into the system.

        _C_h_a_n_g_i_n_g _p_a_s_s_w_o_r_d_s


        If your password becomes compromised, it's a  simple  matter
   to  establish  a new one. This is accomplished by using the Pass-
   word command which has the following format:
                       passwd
   example: suppose your password is happy and you want to change it
   to sorrow.
             First locate the system's prompt  character  (%),  then
   type:
                              % passwd
                   Response:  name:
                     Type  :  <your login-name>
                   Response:  OLD PASSWORD:
                     Type  :  happy
                   Response:  NEW PASSWORD:
                     Type  :  sorrow
                   Response:  NEW PASSWORD:
                     Type  :  sorrow
                   Response:  %

        The presence of the  prompt  character  indicates  that  the
   password has been changed. The next time you log in, don't forget
   to enter sorrow as the password.  The double prompt for  the  new
   password is a precaution against entering the wrong password.  If
   you don't enter the same password each time, the system will  not
   change the password, but will display:

                       passwd: new passwords don't match
                       %

   Notes: (1) Do not type the prompt when entering  the  above  com-
              mands,  it  is  automatically generated by the system.

                                - 11 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix

              Also, the passwords will not be displayed as indicated
              in the above example.
          (1) Passwords must be a minimum of five  characters  long.
              It  is a good idea to have a number in it as well. Try
              not to choose passwords that someone might guess. This
              includes  names,  phone  or license numbers, ect.  The
              password is the only thing that prevents  others  from
              gaining access to the system under your account.

        _L_o_g_o_u_t


        The "Logout" command is used to discontinue your  access  to
   Unix. It has the following form:

                       logout <return>

   The system will then prompt you to log in. Just ignore the prompt
   if you have finished all you intended to do.

   Example:
        % logout
        User mmw logged in on ELROND at Tue Nov 6 13:11:40 1979
        User mmw logged out of ELROND at Tue Nov 6 13:25:25 1979

        (The screen is cleared and a "beep" sounded before the  fol-
        lowing appears.)

        ELROND -- UNIX 6th Ed.

        login:

   Note: Always log out once you have  completed  your  task.   This
         prevents unauthorized use of the system. Keep in mind, how-
         ever, that when you type "logout" UNIX will  take  measures
         to  terminate  _a_l_l  programs  you may have running. It will
         even affect "background jobs." To leave the system  without
         affecting   background   jobs   type  "detach"  instead  of
         "logout." Though this may seem a bit obscure at this point,
         its significence will become apparent later.

        _E_x_e_r_c_i_s_e

   1. Using your login name and password,  practice  the  login  and
      logout procedures at least three times. Keep in mind all spac-
      ing must be exactly as shown in the examples.

   2. Use the appropriate commands to change your password to a  new
      one and then back to the original.



                                - 12 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


        _C_o_r_r_e_c_t_i_o_n _C_h_a_r_a_c_t_e_r_s


        The current input line may be  corrected before the line  is
   sent to the computer by using the following characters:

      @ ---- Erases all  characters typed on the line before it.

      # ---- Erases the last character typed.   Successive  uses  of
             the  '#'  can  erase characters back to, but not beyond
             the beginning of the line.

        _E_X_A_M_P_L_E_S

   1. a.  You are entering the PASSWD command discussed earlier  and
          you type,

                         % pasw

          You notice that one "s" is missing. There are  two  things
          you can do: (a) depress the RETURN key and begin again, or
          (b) correct the line by typing:

                         %pasw#swd

          This causes the "w" preceding the '#' to be erased.

      b.  To correct more than one character, type a  "#"  for  each
          character to be erased, as follows:

                         %paaswd####sswd

          This causes the characters "aswd" to be  replaced  by  the
          characters  "sswd". Note that even though only one charac-
          ter had to be replaced, all characters following the char-
          acter in error had to be erased.

   2. a.  Suppose you have typed --- %login mmw; you  can  eliminate
          the extra "g" by typing:

                         %loggin mmw#######in mmw

                         or

                         %loggin mmw@login mmw

   Note:  A blank or space is a character and must also be  deleted.
          Keep in mind that the only way a character in error may be
          corrected is by using one of the above  methods.  On  some
          systems when you type the # the cursor will move backwards

                                - 13 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix

          and erase the previous character; when you type @ the cur-
          sor will advance to a new line.



        _E_x_e_r_c_i_s_e


        Make some deliberate errors and then use  the  "@"  and  "#"
   characters to correct the errors.




        _I_n_f_o_r_m_a_t_i_o_n _c_o_m_m_a_n_d_s


        _W_h_o _c_o_m_m_a_n_d

   Do you want to know who is using the system at the same time  you
   are? You can find out by simply typing:

                         who <return>

   The system will display the login-name,  terminal-id,  and  login
   time for each current user.

              Example:   mmw   tty1 mar 20 13:22

                         er    tty2 mar 20 09:44

                         mse   ttyn mar 20 12.04

        This command can also be used to let you know  who  you  are
   logged in as. I'm not implying that you are senile, only that you
   may log in under more than one login-name.  This is  not  unusual
   when  several persons are assigned to the same project.  The form
   of the command is :

                         % who am I

   This produces the same response as  the  one  received  from  the
   "Who" command, but just for you.









                                - 14 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix

        _W_h_e_r_e _c_o_m_m_a_n_d


        This command is used to determine the locations of Unix ter-
   minals.  The form of the command is:

                         % where tty

   The system will display a list consisting of the room  and  tele-
   phone numbers of terminal locations.

               example: B2E11 FANX 3 local   tty1  8779
            B2E11 FANX 3 local   tty2  8779
            A2310 Fanx 2 R8      ttyl  8915
            A2538 Fanx 2 R82     ttym  8868
            A2A22 Fanx 2 E21     ttyn  8020
            A2D66 FANX 2 R73     ttyo  8134
            A1D63 FANX 2 R812    ttyp  7379

   Also, by specifying a particular terminal in the where command

               % where tty1
               B2E11 FANX 3 local   tty1 8779

   it is possible to obtain only the information  relating  to  that
   terminal.

        _D_a_t_e _c_o_m_m_a_n_d

   To determine the current date and time, use the "Date" command:

                         % date

   which will yield a display similar to this:

                     Mon Aug 28 13:40:24 EDT 1978

        _N_a_m_e _c_o_m_m_a_n_d


        With the "Who" command, you learned  how  to  determine  who
   else  was  using the system besides you. However, only the login-
   name was displayed.  The "name" command takes you a step further,
   it allows you to display a user's full name. For instance:

                         % name  <login-name>

               Type:     %name mmw

           Response:    mmw E21 Mildred M. Ware


                                - 15 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix

        _E_x_e_r_c_i_s_e


        Issue all four of the Information commands. (In case  you've
   forgotten,  they are WHO, WHERE, DATE and NAME.) When you finish,
   continue with the next section.














































                                - 16 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


        _S_U_P_E_R_B_E_E _T_e_r_m_i_n_a_l _M_a_l_f_u_n_c_t_i_o_n_s



    1.  The terminal may occasionally return to an off-line  depress
        the on-line button.

    2.  The terminal may get stuck in the upper-case character mode;
        this  causes  everything typed to appear in capitals. Unfor-
        tunately, the system doesn't recognize any user commands  in
        upper-case  letters.  To  remedy  the situation, type:  STTY
        -LCASE. If this doesn't clear the malady, turn the  terminal
        off and log in again.

    3.  If the system doesn't recognize any commands or won't  allow
        you  to  enter  any  commands,  depress the RUBOUT key, then
        depress the RETURN key. If this proves futile after  several
        attempts --- turn the terminal off and log in again.

    4.  It would be a good idea to obtain a copy of  "The  Care  and
        Feeding of Terminals" from operations.

   Note: If the problem still exists after having tried these  solu-
         tions,  contact  the  operations people and have them reset
         the terminal.

        _D_e_l_t_a _D_a_t_a _I_n_f_o_r_m_a_t_i_o_n

    1.  The Delta Data 7000T  is  the  Agency's  standard  terminal.
        Because of certain design features it is necessary to "load"
        the terminal with a special "emulator" program. This must be
        done  every  time  the  power  is turned on or off. The most
        important thing to remember is that until  the  terminal  is
        loaded  it will not send the characters that are engraved on
        its key caps.  Somewhere in the vicinity of the terminal you
        should find a set of instructions for loading entitled "Care
        and Feeding of the D7000 Terminal."

    2.  With the Delta Data it is advisable that you  not  shut  the
        terminal  off  during the day so the next user will not have
        to perform the load procedure.

    3.  Never remove the plug from a Delta Data while the  power  is
        turned on as this will destroy the terminal.

        This is the end of the instructional sequence for Module  I.
   Do  any  review or verification you feel necessary, and then take
   the module test, which is on the next page.



                                - 17 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


        _M_o_d_u_l_e _I _T_e_s_t - _P_a_r_t _I

   Instructions:Answer the following questions without aids  of  any
   kind. Minimum passing score is 5 out of 8 correct.


    1.  Information is sent to the computer
            a.  a page at a time
            b.  one line at a time
            c.  either a or b

    2.  Corrections may be made to an input line
            a.  before you advance to another page
            b.  anytime you want
            c.  before you depress the RETURN key

    3.  The -------- looks like an underscore or a big  white  block
        and indicates the next input position.

    4.  To clear the entire screen, depress the ----- key.

    5.  To send information to the computer,  depress  the  --------
        key.

    6.  To halt execution of a command, depress the ------ key.

    7.  The --------- and ------- are used to make corrections to an
        input line before it has been entered to the computer.



    *** Check your answers with the answers on  the  page  following
        part II. If you miss more than 3 of the above questions, you
        should review all the material in module I before continuing
        with part II.
















                                - 18 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


        _M_o_d_u_l_e _I _T_e_s_t - _P_a_r_t _I_I

   The following exercises are to be done using the terminal.

    1.  Perform the start-up procedure.

    2.  Gain access to the system by performing the LOGIN procedure.

    3.  Direct the system to execute the LOGOUT command.
            a.  perform #2 again, this time change your password  to
                something else.
            b.  Deliberately make an error in the line and enter it.
            c.  Re-enter the same line except this time use the  '#'
                to correct your errors.
            d.  Re-enter the line again using the '@' to correct the
                line.

    4.  Perform #3 again.

    5.  Perform #2 again, and change your password back to  what  it
        was originally.



    *** Repeat these exercises until  you  can  perform  these  pro-
        cedures without reference materials.

























                                - 19 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


        _A_n_s_w_e_r_s _t_o _M_o_d_u_l_e _I _T_e_s_t(_P_a_r_t _I)



    1.  The answer is (_b).  All information is sent to the  computer
        one  line  at a time.  If you missed this, please review the
        RETURN key.

    2.  The answer is (_c) Corrections must be made to an input  line
        before you depress the RETURN key.  Depression of the RETURN
        key sends the line of information you typed to the  computer
        an  causes  the  system to display an error message.  if you
        missed this question, please review the section  on  correc-
        tion characters.

    3.  _T_h_e _c_u_r_s_o_r looks like an underscore or a big white block and
        indicates the next input position.

    4.  _C_l_e_a_r is used to clear or blank the entire screen.

    5.  To send information to the computer; depress the _R_E_T_U_R_N _K_E_Y.

    6.  To halt execution of a command, depress the _R_U_B_O_U_T _K_E_Y.

    7.  The # and @ are used to make corrections to an  input  line.
        If you missed this question, review correction characters.

























                                - 20 -
   Unit I                                                   Module I







   MP119                                        Introduction to Unix


            _M_o_d_u_l_e _I_I---_I_n_t_e_r-_u_s_e_r _c_o_m_m_u_n_i_c_a_t_i_o_n


        This module covers unit I objective 4.




   Upon completion of this module you will be able to:



    1.  Receive messages from other users.

    2.  Send messages to other users and yourself.

    3.  Communicate interactively with other users.

    4.  Send reminders to other users and yourself.
































                                - 21 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


        _M_e_s_s_a_g_e _c_o_m_m_m_a_n_d


        Unix has its own postal system so you can send  and  receive
   letters from other users of the system.

        All users are given what is called a MAIL file;  the  system
   uses this file to maintain  letters or messages sent to you.

        Upon  logging  in  you  may  sometimes  see   this   message
   displayed:
                       You have mail

   This means that someone has sent you a message and the system has
   placed it in your MAIL file.

        _R_e_a_d_i_n_g _y_o_u_r _m_a_i_l


        To read your mail, issue the command,

                       % msg <return>

   This gives you access to your MAIL file.  Upon entering this com-
   mand, the system will respond by displaying:

           readmail -- version 1.2 of 14-sep-76
           1 107 char 24 jan 1978 mmw leave
           2 225 char 30 jan 1978 er  system maintenance
           2 messages
           for help type ?
           -->


        The first of the  displayed lines indicates the name of  the
   program  used, the release no., and the revision date. The second
   and third lines depict message header lines, which consist of the
   following information:

             <message no.> <no. of characters> <date sent>

             <login name of sender> <subject of message>

             3ti -10 Example:
             1 107 char 24 Jan 1978 mmw leave






                                - 22 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

        If  the  sender  didn't  specify  a  subject,  ???  will  be
   displayed.

        The fourth line lets you know the number  of  messages  con-
   tained  in  your file, and the fifth line instructs you to type a
   "?" to obtain help in using the program. The "-->" indicates  the
   system  is ready to accept input, one of the Message program com-
   mands --- these commands will be discussed shortly.

        While you are using this program the system will display the
   "-->" as the input prompt character instead of the "%".

        _S_e_e_k_i_n_g _h_e_l_p

   If you type:
                       ? <return>

   the system will display the following list of commands  that  may
   be issued while using the Message program :

             b[ack-up  and print message]

             d[elete] <message no>...

             e[xit and overwrite current mail file to reflect
               deletions]

             h[eaders of messages:] <message no>...

             n[ext-message-is:]

             s[ave mail and exit]

             t[ype] <message no> ...

             q[uit]

   <message no > is of the form [number] [:[number]]

   Examples: 2 is 2, 2:4 is 2 through 4, 2: is 2 to  the  end,  : is
   everything, "a" means ALL messages, "u" means undeleted messages,
   and "d" means DELETED messages.










                                - 23 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

   Note: Several other commands involving the use of files will also
         be  displayed. However, we are going to focus our attention
         on only the above commands until file manipulation has been
         discussed.   If  the  b,d,h,n, or t commands are issued and
         your mail file contains 0 messages, the  system's  response
         is:  -->  no  file.  This  indicates that your Mail file is
         empty.

        _E_x_e_r_c_i_s_e:

   We've covered a lot of ground. Let's review the use of  the  mes-
   sage commands before moving on.


    1.  Suppose you see this display upon logging in:
                       You have mail

        What command would you issue to gain  access  to  your  MAIL
        file?

    2.  Upon entering the command asked for in question 1,  you  get
        this display:
                  readmail - version 1.2 of 14-sep-76
                  1 53 char 2 feb 1979 leb timecard
                  2 96 char 4 feb 1979 rak schedule
                  2 messages
                  for help type ?
                  -->

        Explain what the second line means.

    3.  Now assume you need help and type:
                            ?

        The system displays the following list of commands that  can
        be used with the Message program:

                            b
                            d <message no>
                            e
                            h <message no>
                            n
                            s
                            t <message no>








                                - 24 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

        What does each command accomplish?

                            b _______________________
                            d _______________________
                            e _______________________
                            h _______________________
                            n _______________________
                            s _______________________
                            t _______________________
                            q _______________________

    4.  Suppose you want messages 1 through 3  displayed.  Which  of
        the following is the correct command?

                            d a   ____
                            d 1:3 ____
                            t a   ____
                            t 1:3 ____

    The correct answers are on the next page.
































                                - 25 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


        _A_n_s_w_e_r_s:



    1.  % msg <return>

    2.  The first message in your mail file has  53  characters,  is
        dated 2 February 1979, was originated by login name leb, and
        the subject is timecards.

    3.  b[ack up and print message
        d[elete message no......
        e[xit and overwrite mail file to reflect deletions
         reflect deletions
        h[eaders of messages <message no>
        n[ext message is
        s[ave mail and exit
        t[ype <message no>
        q[uit (Exits program but does no updating)

    4.  Answer d. (t 1:3) is correct. Answer b (d  1:3)  of  course,
        would delete messages 1 through 3.



   ***If you feel you understand the meanings of  the  message  com-
      mands,  you  are ready to actually use the commands and should
      move on to the next section. Otherwise,  review  this  section
      before going on.






















                                - 26 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


        _U_s_i_n_g _t_h_e _c_o_m_m_a_n_d_s


        When issuing a command, type only the letter to the left  of
   the  "[".  Assume  you have 4 messages in your MAIL file, and you
   want to read the second message; you would type:

                       t 2 <return>


        The system would display:

              --> type 2
             (message 2, 225 bytes)
             FROM: er
             DATE: 30 Jan 1978 at 1416-EST
             SUBJECT: system maintenance
             TO: mmw

             Time sharing will cease at 0900 on Jan 31st  for  regu-
             larly  scheduled  maintenance.  Normal  operations will
             begin again at 1200 hours.

             -->

        _D_i_s_p_l_a_y_i_n_g _m_e_s_s_a_g_e_s


        The "t" command is used to display messages that  have  been
   placed in your MAIL file.  Several variations of this command may
   be used.  Let's take a look at these now.


    1.  To display all the messages in your file, you have a  choice
        of using either of the following two forms:

             (a) type:      t a   <return>
                 response:   --> type all messages

             (b) type:      t :  <return>
                 response:   --> type :

        Following either of these commands, the system will  display
        all the messages you have in your file.







                                - 27 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

        Notes: 1 The system will also display  messages  deleted  in
                 this  session.  The  deleted messages are displayed
                 with an  "*"  beside  the  message  number  in  the
                 header.
               2 Response refers to the information displayed by the
                 system.

    2.  Suppose you accidentally deleted a message before  you  read
        it,  and  you  don't  wish  to view all the messages in your
        file, what then? Never fear --- Unix is  here.  Unix  allows
        you to display recently deleted messages by using:

                       t d    <return>
               response: --> type deleted messages

        The system will now display only the messages which you have
        deleted during this session.

    3.  You also have another option. If you want to read or  review
        only the mail which is to remain in your file, you can do so
        by typing,

                       t u    <return>

               response: type undeleted messages

        This directs the system to display only the  messages  which
        have not been deleted.

        _D_e_l_e_t_i_n_g _m_e_s_s_a_g_e_s


        As you have probably surmised, you may delete messages  from
   your  MAIL  file. This eliminates a cluttered file and saves time
   in accessing the Message program. Therefore,  when  you  use  the
   mail file you should delete a message after reading it, unless it
   contains some pertinent information that should be kept for later
   reference. A message is deleted by typing:

                       d <message no>

   where "d" initiates the delete command and "<message no>" is  the
   number of the message to be deleted.

   Examples:


    1.      type: d 2 <return>
        response:  --> delete 2
        Will delete message number 2.


                                - 28 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

    2.      type: d 2:4 <return>
        response:  -->
        Will delete messages 2 thru  4


    3.   type d
        response:   -->
        Will delete the "current" message.
        or,
        type d a
        response:   --> delete all messages
        Will delete all messages from your MAIL file.

        _O_t_h_e_r _c_o_m_m_a_n_d_s

   1. h[eaders] <message no>

      The system will display the header information for the  speci-
      fied  message(s). If the message number is omitted, the header
      line  of  the  last  referenced  (current)  message  will   be
      displayed.  If  "a"  replaces  the  message number, the header
      information for all messages will be displayed.


   2. n[ext message is:]

      The message assigned the next highest number  to  the  current
      message is displayed.


   3. b[acking up to:]

      The message just before the current message is displayed.

        _E_x_i_t_i_n_g _t_h_e _M_e_s_s_a_g_e _p_r_o_g_r_a_m


        Now that you have read your mail and discarded the  messages
   for  which  you have no future use, the next step is to leave the
   Message program to return to the command level.  There are  three
   commands which can be used; these are:

   1. s[ave mail and exit]

      This is really a misnomer. It does cause you to exit the  Mes-
      sage  program   but  does  not save your mail, i.e., your mail
      will not be retained in your MAIL file. The Save command  will
      move all undeleted messages from your MAIL file and place them
      in a backup file called "savemail." This is the  usual  option
      if  you  don't want to collect mail in one mail file. Later on
      you can look at the file SAVEMAIL to recall old messages.

                                - 29 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

                   To use,

                   type:         s
                   response:    -->  save[confirm]
      The system expects you to enter either a 'y' for  yes,  or  an
      'n'  for no. If an 'n' is entered, the command will be ignored
      and you remain in the Message program .


   2. q[uit]

      Causes you to exit the Message program but  does  not  perform
      any  updating;  i.e.,  your  MAIL file remains in its original
      state. Your file will not be modified to reflect  any  of  the
      deletions you made.


   3. e[xit and update]

      Causes you to exit the message program and to update your MAIL
      file.  Any message you deleted while using the Message program
      will be removed from your MAIL file.   The  response  to  this
      command will be:

           exit and update file  <filename> [confirm]

      As with the save command, you must enter a  'y'  if  you  want
      this command executed.


   Note: After execution of any of the  above  three  commands,  the
         system  will  display  the prompt (%) indicating that it is
         ready to accept another command.  Please note that each  of
         these commands performs a different function. Please review
         the exit command if you can  not  discern  the  differences
         between them.
















                                - 30 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


        _R_e_v_i_e_w _Q_u_e_s_t_i_o_n_s


        Let's review the "exit" commands and practice the  "message"
   commands.

   1. To exit the Message program without updating it,  the  _______
      command is used.

   2. To exit the Message program and update it, the _______ command
      s used.

   3. If you want to move all undeleted messages from your MAIL file
      and  place them in a backup file, you would use the _____ com-
      mand.




        _E_x_e_r_c_i_s_e_s

       1.  Issue the "Message" command.


       2.  Type the "?."


       3.  Issue the "type" command.


       4.  Exit using the "save" command.


       5.  Perform #1 again and exit using the "quit" command.


       6.  Do again any of the above you don't feel confident about.














                                - 31 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


        _A_n_s_w_e_r_s _t_o _t_h_e _R_e_v_i_e_w _Q_u_e_s_t_i_o_n_s

       1.  q[uit]

       2.  e[exit and update]

       3.  s[ave mail and exit]












































                                - 32 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


        _S_e_n_d_i_n_g _m_e_s_s_a_g_e_s


        As previously mentioned, the system also allows you to  send
   messages.   These messages may be sent to other users or to your-
   self. You may also send the same message to several users  simul-
   taneously.

        When a message is sent to someone, the system will place the
   message  in  that person's MAIL file.  The command used to send a
   message is:
                            sndmsg

        This command is very simple to  use,  because  the  "sndmsg"
   program issues several prompts to guide you in using the program.
   Examples:

            Type: sndmsg

        Response: TO:

            Type: <the login name(s) of the primary  receiver(s)  of
                  the message>

        Response: cc:

            Type: <the login names of other persons to  receive  the
                  message>  If  more  than  one  login name is used,
                  separate each by a comma.  If there  are  no  such
                  users  to  receive  the  message, just depress the
                  "RETURN" key. If more than one line is  needed  to
                  specify  all  receivers, end the first line with a
                  comma and continue on the next line.

        Response: Subject:

            Type: < what the message pertains to> This may be a sin-
                  gle  word,  a  phrase,  or it could be you needn't
                  specify a subject. If the latter, then depress the
                  RETURN key.

        Response: type message; end with <EOT> (ctrl-D)

            Type: <message to be sent>
                  <ctrl-d>






                                - 33 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

        Response: queue, send, editor or re, ed, input,  file,  jus-
                  tify, display,  or ?:

            Note: Before responding to the above  prompt,  a  little
                  explanation  is in order.  You are to enter one of
                  the above commands to inform  the  system  of  the
                  action  to take regarding your message. The system
                  will continue to issue this prompt until you enter
                  "send" or "queue".


        Concern yourself with only the following commands:

   s[end]....Places the message  in  the  indicated  person/person's
             Mail  file.   It  waits  until the mail is delivered to
             each person.  When sending mail to other  systems  this
             can take some time.

   q[ueue]...Similar to send, except when used to send  messages  to
             persons  on other systems, the mail is queued for later
             delivery.  "QUEUE" is preferred to "SEND".

   edi[tor]..Invokes the RAND Editor; thus the message may be  modi-
             fied  before being sent.  (The RAND Editor will be dis-
             cussed in a later unit.)

   re........Invokes the RAND Editor; thus the message may be  modi-
             fied  before being sent.  (The RAND Editor will be dis-
             cussed in a later unit.)

   ed........Invokes the Text Editor, which is also used to modify a
             message.  (The Text Editor will be discussed in a later
             unit.)

   j[ustify] Formats the message nicely.

   f[ile]....Allows you to add to your  message.  Appends  the  file
             specifed to the message.

   d[isplay] Displays the message.

   i[nput]...Allows you to add to your message.

   ?.........Gives an explanation of the  commmands  listed  in  the
             prompt.

   Note: Only the first letter of the commands, with  the  exception
         of ed, is entered.




                                - 34 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

        All right, now continue with your input to  the  prompt.  Do
   this at the terminal.

           Type: <enter one of the commands; e.g., display>

       Response: <depends on the command you entered>

        Try two or three of the other commands to make sure you have
   the hang of it.

        _P_o_i_n_t_s _o_f _i_n_t_e_r_e_s_t



    1.  Entering the "send" or "queue" commands causes you  to  exit
        the SNDMSG program.  The system will respond with:

                    <receiver's login name> -- ok

    2.  If the receiver of the message is  logged  in  an  interrupt
        will occur on his terminal which consists of a loud beep and
        the message:

                        [You have new mail]

    3.  If the receiver of the message isn't logged in at  the  time
        the message is sent the system will place the message in the
        person's MAIL file. When the person does log in, he  or  she
        will be informed that a message is in the MAIL file.

    4.  If an invalid login name is specified as being the  receiver
        of  the  message, don't become alarmed, the system will only
        display the following:

                    <login name> -- not a local user

        A copy of this letter has been left in 'unsent mail'

    5.  The UNIX Systems people would like to  know  if  you  aren't
        satisfied, so if you have a complaint pretaining to the ser-
        vice you are receiving, send a message to "gripe" indicating
        the problem.










                                - 35 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

    6.  If you send a message to a person  on  another  computer  or
        system other than the one you are logged in on, the "sndmsg"
        command requires a little more information.  In addition  to
        specifying  the  login-name  of  the receiver, you must also
        specify the system he is logged in on. For example, you  are
        on the ELROND system and you wish to send a message to "hdd"
        on  the CARONA system.  When you receive  the  prompt    TO:
        you would type:

                            hdd@carona

        The "@" informs ELROND that the message is to be sent  to  a
        user on another system.

        _E_x_e_r_c_i_s_e_s

    1.  Issue the "sndmsg" command to send a message to yourself.

    2.  Display the message before sending it.

    3.  Modify the message to reflect some change.

    4.  Send the message.

    5.  Read the message sent in  #1.

    6.  Repeat 1 and 2

        _W_r_i_t_e _C_o_m_m_a_n_d


        The "write" command provides a means of establishing a  two-
   way communication path.  This is accomplished by typing:

                       write <login name>

   where <login name> is the login name of the user you wish to con-
   tact.

        When the "write" command is issued, the system  will  prompt
   the specified user by a startling beep and the message:

                       message from <your login name>

   Then the specified user would respond by typing:

                       write <your login name>





                                - 36 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

        The two-way communication path has  been  established.   Now
   whatever  you  type on your termimal will appear on the specified
   user's terminal, and  whatever  the  specified  user  types  will
   appear  on your terminal. That is, until you enter <ctrl-d> which
   ends the communication path.

        Now  let's  look  at  an  example  illustrating  the   steps
   involved.

        Assume user tml wants to contact user scc,

           tml types:  write scc
        system types:  scc has been notified.  Wait for response.
        system types:  Type ? for help.


        scc receives:  <beep>
        Message from tml on tty X at ELROND
        To respond, type write tml

   Note: User tml waits a while to  determine  whether  contact  has
         been  made.   If scc is available and wants to complete the
         two-way communication path,

         scc types: write tml

         tml receives: Message from scc on tty P at ELROND
         Go ahead.

   Note: If scc is using another program, such as the  message  pro-
         gram,  when  the  prompt is received, scc will have to exit
         that program and return to the command level  in  order  to
         respond to the "write" command.


   The conversation now begins.

       tml types: <his message, as many lines  as  he  likes>   When
                  he's  ready  for  a  reply,  he  signals by typing
                  <cntrl Y>

       scc types: <his reply, followed by (cntrl Y)>

   This cycle continues until the conversation is finished. Then

      tml types: <ctrl-d>     Ends two-way path

   scc receives:  tml has quit
      scc types:  <ctrl-d>

   tml receives:  scc has quit

                                - 37 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

   Notes: 1. If you write to someone who isn't logged in, the System
             will let you know. If you don't get a response from the
             system, and the  other  user  doesn't  answer  after  a
             decent  interval,  simply  type  <ctrl-d> and try again
             later.  He is logged in, but is  probably  not  at  the
             terminal or is busy nad can't respond.
          2. The write command has been modified to reflect the fol-
             lowing enhancements.

             a. The sender will now be  informed  that  contact  has
                been made by displaying the message:

                     <receiver> has been notified, wait for reponse

          3. If the user to whom you are writing is  in  "protected"
             mode  (e.g. the Rand editor) the message "write permis-
             sion denied" will be displayed.
          4. Write will allow you to talk to people  on  other  sys-
             tems.   Suppose that you are on ELROND and want to talk
             to hdd  on CARONA:

                  type:     write hdd at carona
                  response:

             After this, continue on as above. If hdd is not  logged
             in you will get the following message:

                  You will have to try later
























                                - 38 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


        _E_x_e_r_c_i_s_e


        Practice writing to other-users, if you don't know any other
   users, type:

                            % who

   Remember, this gives a list of the login  names  of  all  persons
   logged  on  the  system.  Just choose one, then get acquainted by
   writing.

        _R_e_m_i_n_d _C_o_m_m_a_n_d


        The "remind" command is also used to send messages. However,
   we  call  these  messages  reminders, because you can specify the
   time the message is to be sent.  You may specify  that  the  rem-
   inder  is  to  be sent today, tomorrow, next week, next month, or
   several months  from  now.   This  command  has  several  options
   (referred  to  as arguments) which may be used or omitted and has
   the following form: remind  <user>  ...  <mo/da/yr>  <hr:min>  <-
   r"reminder">

        Example: remind mmw 2/4/78 2:30pm -r"It's 2:30"

        The above would cause the  system  to  prompt  user  mmw  on
   February  4th at 2:30pm by displaying the reminder accompanied by
   a loud beep, e.g.:

   *******************MESSAGE*********************************
            FROM er TO mmw
            SENT...........Sat Feb 4 10:49:39 1978
            FOR DELIVERY...Sat Feb 4 14:30:00 1978

              It's 2:30
   ***********************************************************

                    [you have new mail]

   Notice the system places the reminder  in  your  MAIL  file.   To
   enter another command, depress the <RETURN> key.

        _O_p_t_i_o_n_s


        Now for a more  in-depth  discussion  of  the  many  options
   available to you.

   <user> --------- This argument  is  used  to  specify  the  login

                                - 39 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

                    name/names  of  the user(s) to which the message
                    is being sent. If more than one user  is  speci-
                    fied,  separate  each  by a space.  If <user> is
                    omitted, the message is sent to you.

   <mo/da/yr>-------The date the reminder  is  to  be  delivered  is
                    specified in this form, where mo, da, and yr are
                    whole numbers. This  argument  is  divided  into
                    three   fields  ---  the  slashes  are  used  to
                    separate the fields.

                    _O_m_i_t_t_e_d _f_i_e_l_d_s:

                         You may  omit any of  these  fields.   How-
                    ever,  the  first  of  the  slashes must appear;
                    e.g., if you type /20  for  this  argument,  the
                    message  will  be  delivered  on the 20th day of
                    this month. Thus, when  any  of  the  fields  is
                    omitted, the system assumes you are referring to
                    the current month, day, or  year.  Consequently,
                    you may omit this argument entirely.

                    _R_e_l_a_t_i_v_e _d_a_t_e _s_p_e_c_i_f_i_c_a_t_i_o_n:

                         The fields may be also preceded by  a  plus
                    sign.  If  so, it is taken to be relative to the
                    current month, day,  or  year;  e.g.  /+1  means
                    "tomorrow."  I  if  the current date is 4/24/78,
                    5/+9 means the reminder  will  be  delivered  on
                    June 2nd, since May, the 5th month, has 31 days.

                         Ok, you do this one. If the current date is
                    3/9/78, and you enter 6/+4 as the argument, what
                    date will the reminder be delivered?


                         If you said 6/13/78, good, that's  correct.
                    Suppose  you  try  another.  The current date is
                    2/3/78, and you enter /+10, when will  the  rem-
                    inder be delivered?


                         Is your  answer  2/13/78?  If  not,  please
                    review this section.

   <hr:min>---------The time of the day that the reminder is  to  be
                    delivered  is  specified  in this form, where hr
                    and min are whole numbers.  Either  of  the  two
                    fields (fields being separated by ":" this time)
                    may be omitted; if the  colon  is  missing,  the
                    minute field is assumed to be zero .

                                - 40 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX

                         The time may be specified on the  basis  of
                    24  hour  clock  (0800)  or the usual convention
                    (8am, 8:00, 8, 8:00am). Any of  these  forms  is
                    acceptable.

                    _R_e_l_a_t_i_v_e _t_i_m_e _s_p_e_c_i_f_i_c_a_t_i_o_n:

                         Either field may  be  preceded  by  a  plus
                    sign.  The  time is then taken to be relative to
                    to the time the  "Remind"   command  is  issued.
                    Thus,  if  the  command  is  issued at 1:30pm on
                    2/4/78, and the time is entered as  +1:15pm  the
                    message  is  sent at 2:45 on the specified date.
                    As you can see, the reminder is sent 1 hour  and
                    15 minutes after the command was issued.

                         Ok, here is one for you. The time is 9:10am
                    and +:10 is specified as the time. When will the
                    reminder be sent?


                         Is your answer 9:20am? If so, very good. If
                    it wasn't, please review this section.

   <-r"reminder">---"-r" is a part of the format and must used; your
                    message  or  reminder  is  typed enclosed within
                    double-quote marks. Do not  space  between  "-r"
                    and  the reminder. Also, the reminder can not be
                    continued to another line.  If you wish to  send
                    a  longer reminder, just omit the <-r"reminder">
                    completely, type your message  starting  on  the
                    next line and end it  with <ctrl-d>.

        _E_x_e_r_c_i_s_e



    1.  Issue the "Remind" command directing the  system  to  remind
        you of something 5 minutes from now.

    2.  Issue another "Remind" command directing the system to  rem-
        ind  you  of  something  2  minutes  from now.  Check to see
        whether you get the reminders.

        This is the end of the instructional sequence for Module II.
   Go  back and check the objectives for the module. Can you perform
   as the objectives require? If so, go on to the Module Test, which
   is  on  the  next page. If not, review those sections about which
   you have doubts.



                                - 41 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


                _M_o_d_u_l_e _I_I _t_e_s_t

   Answer the following questions without aids of any kind.  Minimum
   passing score is 8 out of 11 correct.



    1.  You receive the prompt:  [ You have new mail] what does this
        mean?

    2.  The _______________ command is used to read a  message  that
        has been sent to you.

    3.  Write  the  command   to   delete   messages   3   thru   5.
        _____________________

    4.  The ___________command is used to display a message in  your
        MAIL file.

    5.  The commands used to exit the Message program are:
        (a)_________   (b)___________   (c)_____________

    6.  The "save" command will
            a.  exit the Message  program  leaving  your  MAIL  file
                unchanged.
            b.  exit the Message  program  leaving  your  MAIL  file
                unchanged except for the deletions you made.
            c.  exit the Message  program  leaving  your  MAIL  file
                empty,  and copy all undeleted messages into another
                file.

    7.  __________ is the command used to send a  message  to  other
        users.

    8.  Write the command you would  issue  to  send  a  message  to
        "guru," the Chief Systems Programmer of the ELROND system.

    9.  __________ is the command used to exit the "sndmsg" program.

   10.  The __________ command can be  used  to  conduct  a  two-way
        conversation with another user.

   11.  Write the command which could be used to  remind  you  of  a
        meeting at 12:30 on February 28,1980.  Use all arguments.

        The answers to Module II test are on the following page.





                                - 42 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


        _A_n_s_w_e_r_s _t_o _M_o_d_u_l_e _I_I _t_e_s_t



    1.  This means that someone has sent a message to you,  and  the
        system has placed it in your MAIL file.

    2.  The _m_s_g command is used to read a  message  that   has  been
        sent  to  you.  I  know you answered this correctly!  If you
        didn't, please review the Message command.

    3.  _d is the command used to delete messages 3 thru 5.

    4.  The _t/_t_y_p_e command is used to display a message in your Mail
        file.

    5.  The commands used to exit the Message program are:
            a.  quit/q
            b.  save/s
            c.  exit/e

    6.  _c The save command will exit  the  message  program  leaving
        your  MAIL  file  empty. Remember, the "save" command copies
        all messages from your Mail file and places them in a backup
        file, savemail.

    7.  _s_n_d_m_s_g is the command used to send a  message  to  to  other
        users.

    8.  _s_n_d_m_s_g _t_o _g_u_r_u _o_r _s_n_d_m_s_g _t_o _g_u_r_u@_e_l_r_o_n_d is the  command  you
        issue  to  send  a message to the chief  programmer  on  the
        ELROND   system.  (Either  answer  acceptable. Give yourself
        a "nice going" if you give both forms.)

    9.  _s_e_n_d is the command used to exit the 'sndmsg' program.

   10.  The _w_r_i_t_e command can be used to conduct a two-way conversa-
        tion with another user.

   11.  % _r_e_m_i_n_d <_l_o_g_i_n _n_a_m_e> _1_2:_3_0 _2/_2_8/_8_0 -_r"_y_o_u _h_a_v_e  _a  _m_e_e_t_i_n_g"
        Even  though your arguments may not appear in the same posi-
        tion as mine, your answer is still correct.  You will recall
        that placement of the arguments isn't important.

        If you got at least 8 answers correct, you are ready to move
   on to Module III. Otherwise, repeat those sections of this module
   that gave you trouble on the test.




                                - 43 -
   UnitI                                                    ModuleII







   MP119                                        Introduction to UNIX


        _M_o_d_u_l_e _I_I_I---_f_i_l_e _m_a_n_i_p_u_l_a_t_i_o_n


        This module covers Unit I objectives 5,6,7,8,9 and 10.



        _O_B_J_E_C_T_I_V_E_S


        Upon completion of this module, you will  be  able  to  both
   state how to, and to:



    1.  Create text files using the CAT command.

    2.  Display files at the terminal.

    3.  Copy files.

    4.  List the names of existing files.

    5.  Delete files.

    6.  Obtain printed copies of files.

    7.  Compare files.

    8.  Change the mode of files.





















                                - 44 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _W_h_a_t _i_s _a _f_i_l_e?


        A file is a collection of information  stored  by  you,  the
   user,  in  the system. That is, a file contains whatever informa-
   tion you place in it.  It consists of any number of  lines,  each
   of  which  is  concluded  or  delimited  by the depression of the
   RETURN key. A file may contain an unlimited number of  lines;  it
   could  be  a  letter,  a  memo,  portions of a manual, etc.  UNIX
   doesn't require that you use any particular structure or  design;
   it has by far the easiest and simplest method of creating files.

        Files are named by sequences of 14 or fewer characters.  Any
   valid character may be used in upper or lower case. Filenames are
   arbitrarily chosen. However, it is sometimes easier  to  remember
   the  name  of  the  file or the type of information stored in the
   file if you use symbolic names; i.e., let the name  indicate  the
   kind of file it is.

        You may create an unlimited number of files, which are  kept
   in a directory assigned to you by the system.

        The system assigns each user a  directory,  called  a  login
   directory.   A directory is just another type of file and will be
   discussed in detail in Unit II.

        For now, let's see if we can get a good grasp on the concept
   of files by the following analogy.  Imagine the file structure as
   being a library.  You have your own private  book  shelf  (direc-
   tory)  in  which  you keep all your books (files).  Got it? Good.
   Now each book on the shelf must have a  different  title  (name).
   This  applies  only  to  individual  users, that is, someone else
   could have a book with the same title as you,  and  it  would  be
   perfectly all right.

        The manipulation of files is where you will  really  get  to
   see  some  of  the  power and sophistication of UNIX.  You'll see
   that when we create a file.  First,  though,  let's  review  what
   we've just covered about files in general.












                                - 45 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _E_X_E_R_C_I_S_E_S

   Answer the following true-false questions:

    1.  Only certain kinds of information may be placed in a file.

    2.  The maximum number of characters a filename can have is 14.

    3.  A file may contain a maximum of 14 lines.

    4.  A line is concluded (delimited)  by  depressing  the  RETURN
        KEY.

    5.  You can give one of your files the  same  filename  as  that
        given to one of his/her files by another user.

    6.  You can create an unlimited number of files.


































                                - 46 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _A_n_s_w_e_r_s

   1. F     4. T

   2. T     5. T

   3. F     6. T

        I'm sure you had no trouble with these questions. Now, let's
   turn to the task of creating files.

        _C_r_e_a_t_i_n_g _F_i_l_e_s


        UNIX provides several methods which can be used in  creating
   a  file.   This  section  discusses  how this can be accomplished
   using the "cat" (conCATenation) command. (The other methods  will
   be  discussed  later  in  the course.) In case you're interested,
   concatenation means the act of linking together. As used here, it
   indicates  that  certain information is linked together to form a
   file.

        The "cat" command is an extremely versatile command. It  can
   be  used  to  create,  display,  combine  and copy files. You may
   create a file by typing:

                       % cat > filename
                       <information to be stored in file>
                       <ctrl-d>

        "Cat" is the name of the command; ">" is called a divert and
   means to write the information from the program or command on the
   left of ">" into the file on the right of ">."  Since no file  is
   specified to the left of ">," the system places whatever you type
   into the file on the right of the ">." Example:

                       % cat > chap1

                       <now type in whatever text you want>

                       <ctrl-d> signals end of text

                       %

        This creates a file called chap1 which will remain  in  your
   directory  until  you delete it. The command "ctrl-d" signals the
   end of text for the file, and causes  the  (%)  to  be  displayed
   indicating that the system is ready to accept another command.



                                - 47 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

   Note: When you are creating a file, corrections may be made using
         the correction characters.

        _C_o_p_y_i_n_g _F_i_l_e_s


        The "cat" command is used to copy the contents of  one  file
   into  another  file  by specifying a file on the left of the ">".
   Suppose the following command is issued:

                       %cat file1  >  file2

        You would now have two identical files.  The  above  command
   will  cause  the  system  to  read from "file1" and place what it
   reads into "file2"; thereby creating  two  identical  files  with
   different names.

                       _D_i_s_p_l_a_y_i_n_g _F_i_l_e_s


        _C_a_t _c_o_m_m_a_n_d


        How would like to see your creation or maybe show it off  to
   the boss?  You can by using this form of the "cat" command:

                       % cat chap1

        The above form of "cat" is used to display the  contents  of
   existing  files.  The contents of the file will be displayed in a
   continuous stream which makes it somewhat difficult to read.

        As a remedy for this situation, you may use the following:

                       % cat chap1 | br

   where "cat" and "chap1" still have their previous  meaning;  "|",
   the  upper-case  backward  slash, is referred to as a pipe.  This
   causes the system to route your output  through  another  program
   (br).   The  "br"  program  is the browse program that is used to
   cause a pause after each page of output. The "br" now acts  as  a
   filter  and  may  be  used  with any other command which displays
   information on the terminal.  This  command  works  on  both  the
   Superbee and Delta Data terminals.

   Notes: (1)The br program displays one page of output at  a  time.
             It   doesn't   automatically  display  one  page  after
             another. You will have to depress  the  RETURN  key  to
             view  each  succeeding  page.   The  browse  program is
             designed for all standard terminals.          (2)It  is
             possible  to  use  "br" in a manner different from that

                                - 48 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

             specified above. The command:

                       %br chap1

             will do the same thing as:

                       %cat chap1 | br

             and save you some time typing.

        _T_h_e _P_r_i_n_t _C_o_m_m_a_n_d


        The "pr" command is used to  display  files  also.   Wait  a
   minute, don't skip over this just because you already know how to
   display files using the "Cat" command. This command produces for-
   matted  printouts  of your files such as: headings with the date,
   time, page number and file name at the top of each page.

        Several other options are available. Following is  the  full
   form of the command, with the options included:

                  pr [-h (header)] [n] [-t] [-m] [-n] filename

   The options have the following meaning:

   _O_P_T_I_O_N       _M_E_A_N_I_N_G"


   -h          This allows you to specify a header of your choice to
               be  printed  on  the  header line instead of the file
               name, for instance:

                         pr -h SECRET chap1

               will cause the file chap1 to be  displayed  and  will
               produce the following heading on each displayed page:

                         Feb 28 07:57 1978 secret page 1
               instead of:
                         Feb 28 07:57 1978 chap1 page 1

               If the header consists of more than one word, it must
               be  enclosed in quotation marks. As you see, this can
               be used to place a class ification  on  your  output.
               Let's look at the meanings of the other options:


   -p          Begin printing with the page number n, as

                         pr -p3 chap1

                                - 49 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

               The first page of your  output  will  be  numbered  3
               instead of 1.


   -t          Do not print the  header  normally  printed  on  each
               page, for example:

                         pr -t chap1

               will produce output similar to that  obtained   using
               the "Cat" command.


   -m          Since more than 1 file may be specified in  the  "pr"
               command,  this gives you the option of having all the
               specified files displayed on the same page,  side  by
               side; e.g.:

                         pr -m chap1 junk

               will display both files, chap1 and junk, with format-
               ted headers.

   -n          The system will number each line of your text if  you
               specify this option. It looks like this:

                         pr -n junk

               and the output will appear as follows, assuming  junk
               contains the following indicated text.

                    1            Now is the time
                    2            for all good men
                    3            to come to the aid
                    4            |
                    5            |
                    6            |

               Each line, including  blank  lines,  is  sequentially
               numbered.

   Note:  Any of these options may be combined;  however,  it  isn't
          required  that you specify any of them.  The pr command in
          its simplest form is:

                            pr chap1

          The "pr" command can be used as a  filter  also  as  shown
          below:

                         cat chap1|pr

                                - 50 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

                    or:
                         cat chap1|pr -h chap1

   Note:  When pr is used as a filter, the filename is not automati-
          cally printed in the header line.

        _E_X_E_R_C_I_S_E_S


        Let's have a quick review before we move on. Answer the fol-
   lowing questions.

    1.  In the space below print (with  correct  spacing)  what  you
        would type to create a file.


    2.  Suppose you want  to  copy  the  contents  of  "file2"  into
        "file4" print what would follow "%" below:

                       %

    3.  Assume you are going to read a file. What is the  difference
        between the following commands?
            a.  %cat chap3
            b.  %cat chap3 | br
            c.  %br chap3

    4.  What does the following command do?

                       %pr -pn chap1


   Check your answers on the following page.



















                                - 51 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _A_n_s_w_e_r_s:



    1.  % cat > filename
        <information to be stored>
        <ctrl-d>

        Note:  You wouldn't type the "%." It is there to  illustrate
        the process.

    2.  cat file2 > file4  (Remember  --  the  spacing  must  be  as
        shown.)

    3.  The first command means that everything in Chapter 3 will be
        displayed  as a continuous stream.  The second command (%cat
        chap3 | br) displays Chapter 3 a page at a time. (Don't for-
        get,  you  have  to  hit  the RETURN key to display the next
        page.) The third command (%br chap3) will do the same as the
        second.

    4.  It will begin displaying the file with the page number "n"
                       For example:

                       %pr -p88 chap3

        will cause chapter 3 to be displayed,  beginning  with  page
        number  88. Now, don't get confused. This does NOT mean that
        the first 87 pages of Chapter 3 will be  omitted.   All  the
        chapter  is  displayed  and the first page on the chapter is
        given page number 88.

        _O_f_f _L_i_n_e _P_r_i_n_t (_o_p_r)


        As soon as you have your file as you would like  it  to  be,
   I'm  sure you will want to obtain printed copies in order to dis-
   tribute the information to other  people.  This  is  achieved  by
   using the "Off Line Print" command.  It has the form:

                       %opr <filename>
                       Example:% opr chap1

   After a short pause, the system will display the prompt "%." This
   lets you know that your file has been sent to the printer. If the
   system is heavily loaded it might take some time for it to return
   the  prompt.   You  can speed things up by typing "&" immediately
   after the filename.  This puts the job in background, immediately
   returning  the  job ID number and the prompt. You can now work on
   something else while the system performs your job.(If you plan to

                                - 52 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

   logout  while  a  background job is being performed type "detach"
   not "logout" or else the job  will  be  terminated.)  Just  where
   printer  (or  printers)  for your system is located can be deter-
   mined by checking with your system manager.

   Note: 1. If your system has more than one printer, and  you  wish
            to  send  your  output  to a specific facility, you will
            have to give  more  information.  For  example,  on  the
            ELROND computer, you must state the number of the remote
            printer as follows:
                           opr -p1 junk
            Where "1" is the  number  of  the  remote  printer,  and
            "junk"  is  the  file  being  printed.   Check with your
            operations people to find out  the  specifics  for  your
            system.   If you don't specify -p1 the system will print
            the job on the "main" printer.

         2. Files being sent to the printer should not contain  more
            than  2,000  lines. If your file is larger, it will have
            to be divided into smaller files. (See Split Command.)

                  3  The job ID number returned with the  prompt  in
            background jobs is significent. If you want to abort the
            job before it reaches the printer just type  "kill"  and
            the  job  ID  number. Also, some operators will not give
            you your listing unless you specify the job number.

                  4  If you are going to print a classified  job  or
            document you must specify this. For example:

                      opr -c "Hush Hush" junk

            will mark the printout of junk with  the  classification
            Hush  Hush.   (The  classification is enclosed in quotes
            because of the space between the words.)

        _T_h_e _O_p_r _C_o_m_m_a_n_d _a_s _a _F_i_l_t_e_r


        The "opr" command can also be used as a filter.  Some  other
   command  may  be  first  applied to your file for formatting pur-
   poses, then the results of that command is routed  to  the  "opr"
   program to be printed by the "opr" command, as shown below:

                       pr chap1|opr

                  or:

                       cat chap1|opr



                                - 53 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _C_o_n_c_a_t_e_n_a_t_i_n_g _F_i_l_e_s


        Files can be concatenated or combined  by  using  the  "cat"
   command. Using "cat" in the following form:

                       cat file1 file2 file3

   causes the system to concatenate the three files and then display
   them.  As  you  can see, this is a shorthand method of displaying
   three files; the command is only issued once. The  above  command
   is equivalent to:

                       %cat file1
                       %cat file2
                       %cat file3

   When the above form is used, the system displays each  file,  one
   at  a  time, with a prompt after each command. It may be advanta-
   geous to create a permanent file that is composed of the  several
   files. The following command accomplishes this:

                       %cat file1 file2 file3  > file4

   This directs the system to write the several files into  "file4,"
   thus causing them to exist as long as "file4" does.

        Files can be concatenated in the manner described above  and
   then  piped  through the opr program to obtain printed output. It
   should be noted, however, that  this  procedure  will  cause  any
   header lines in the files to be suppressed.

   Note:   When used in this context,  the  same  file  name  cannot
           appear both to the right and to the left of ">."

        _A_p_p_e_n_d_i_n_g _I_n_f_o_r_m_a_t_i_o_n


        Information contained in one file may  be  appended  to  the
   information contained in another file by using:

                       % cat file1 >> file2

   This will append "file1" to "file2."

        How can you use this command to cause  the  information  you
   type  at  the  terminal  to  be appended to "file2" without first
   placing it into a file?  Answer in the space provided.



                                - 54 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

   Is your answer:    % cat >> file2? If it is, wonderful! You  have
   mastered  the "cat" command. Our answer was derived from the fol-
   lowing deduction. Recall the section on creating a file. In  that
   example no file was specified to the left of the ">" and the sys-
   tem treated the input from the terminal as a file. Likewise, what
   you  type  will  be  appended  to "file2," since no file has been
   specified to the left of the ">."

   Ready to try working with files? Here are some exercises to  give
   you practice.










































                                - 55 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _E_X_E_R_C_I_S_E_S



    1.  Create two files, junk1 and junk2. You may type anything  in
        them,  such  as  a page from a book, a letter, your favorite
        limerick, etc.

    2.  Display both files using all four forms of the commands dis-
        cussed  in  this  section.  (In case you don't remember, the
        "cat," "print file," "cat" filtered by "br," and "cat"  fil-
        tered by "pr.")

    3.  Concatenate junk1 and junk2 to form junk3; display junk3.

    4.  Create junk4 by making it a copy of junk2; display junk4.

    5.  Append junk1 to junk4; display junk4.

    6.  Concatenate both junk1 and junk2 and send it to your  favor-
        ite line printer.


   *****If you cannot perform all of  the  above  exercises,  please
        review the "cat" command and then repeat the exercises.


























                                - 56 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _F_i_l_e_n_a_m_e_s _a_n_d _W_i_l_d _C_a_r_d_s


        It was established in the last section that filenames should
   not  exceed 14 characters.  Not that you would get an error, it's
   just that the system ignores all excess  characters.   In  naming
   files,  certain conventions are usually observed so the nature of
   the file can readily be discerned from its  name.  For  instance,
   suppose   your   directory  contained  a  book  where  each  file
   represents a chapter; you might name the files:
                            chap01
                              |
                            chap02
                              |
                            chap20
   Maybe your directory consists of chapters from a book, where each
   file represents a page; you might name the files:
                            pageI
                              |
                            pageII
                              |
                            pageXXV

   You will notice that the file names in each group  are  identical
   except for the suffixes.

        The advantage in using this approach in naming your files is
   the  ease  and flexibility it affords in manipulating your files.
   This flexibility is made possible by the  use  of  "wild  cards."
   "Wild cards" are special characters which may be used as prefixes
   or suffixes to filenames. They allow the same action to  be  per-
   formed on many files by a single command.

        The "wild card" characters are:

   "*"       Matches any  string  of  characters.   Thus  "*"  alone
             matches all filenames in your directory.

                  Example:   % cat *

             will display all files in your directory.

                  Example:   % cat chap*

             will display all files beginning with "chap."






                                - 57 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

                  Example:   % cat *chap*

             will display all files containing  "chap"  anywhere  in
             the name.

             Answer this question in the space  below.   %cat  *chap
             --- will display which files?


             If you said all files ending in chap, good.  Otherwise,
             review the beginning of this section.

   "?"       Matches any single character; thus "?" alone refers  to
             filenames consisting of one character.

                            Example %cat ?

             will display all files having exactly one character for
             its name.

             Here is a question for you.  Be  careful,  it's  a  bit
             tricky.

                  %cat chap? --------- would display which files?

             If your answer is all files  with  names  5  characters
             long beginning with chap, very good. For example, if if
             you had files chap1 through  chap16,  the  files  chap1
             through  chap9 would be displayed.

   [...]     "[...]" means to match any of the characters inside the
             brackets.   Thus, "[xyz]" means to match any one of the
             characters:  "x," "y," or "z." "[a-g]"  also  means  to
             match any single character from "a" through "g."

             Examples:

                  % cat chap[a-c]     and     % cat chap[abc]

             will display files, "chapa", "chapb",  and  "chapc"  if
             they  exist.  However,  no  error  is generated if they
             don't.

             Which files would be displayed by this?

                            % cat chap[12345]


             You're correct, if you answered all files beginning  in
             chap and ending in 1,2,3,4 or 5.


                                - 58 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

   Note: 1. Wild cards are used only in referring to existing files,
            and can not be used in creating new files.
         2. Any of the "wild cards" may be combined.
         3. Of these niceties, the "*" is the most useful,  and  you
            should use it until you become confident in its use.
         4. Wild card  expressions  are  typed  solid;  no  embedded
            spaces are permitted.

   Okay, for a rating of excellent, answer this one correctly: Which
   files will be displayed by:  %cat *[a-z] ?


   The answer is: all files ending in one of the characters "a" thru
   "z."

        What we did was to combine two "wild card"  characters,  the
   "*"  which  means all files beginning in anything and the "[a-z]"
   which means any file ending in one of the 26  alphabetic  charac-
   ters.


   SPECIAL HINT:  Always, but always, answer the  questions  we  ask
   before looking at the answer.  You'll learn much, much more.



        _L_i_s_t_i_n_g _F_i_l_e_n_a_m_e_s


        The files you have created since completing the last  module
   were  placed  into  your  login directory by the system.  You are
   probably wondering how you will ever  be  able  to  remember  the
   names of these files, so you won't have to keep referring to some
   ledger.  Well, trouble yourself no longer,  for  in  addition  to
   placing  your  files  in  a directory, the system also places the
   names of your files on a list similar to a table of contents.

        You may readily gain access by using the list command  which
   has the form:
                       ls <option>

   where <option> may be -l, -t, -r, "wild cards" and possible  file
   names.   Assume  your directory consist of files: chap.1, chap.2,









                                - 59 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

   junk3, and temp4.  The command:
                       % ls

   will produce this list of all files in your directory.

                       chap.1
                       chap.2
                       junk3
                       temp4

   Note that list is automatically sorted in alphabetical order.

                       ls -t

   The command "ls -t" will list the filenames in the order in which
   they were created or changed (last, first).  This command:

                       ls -r

   will list the filenames in descending order, while

                       ls -l

   produces some very pertinent information about the file, not just
   its  name. It is also the most frequently used of the options. It
   will produce something similar to this:

             -rwx-rw-rw 1 mmw 128 Feb 21 12:05 junk

   The "-rwx-rw-rw" tells who has permission to read, write, or exe-
   cute  the file This topic is discussed later in this module.  The
   "1" indicates how many copies (or links) of the file  exist.  The
   "mmw" is the login name of the "owner" of the file --- the person
   who  created it.  "128" is the number of characters in the  file.
   "Feb  21  12:05" is the date and time the file was created or the
   last time the file was modified.  "junk" is the name of the file.
   I think you can see why "ls -l" is the option used most often.

   Note: 1. Options may be combined: "ls -lt" would produce the same
            thing  as "ls -l," but would be sorted to show the order
            in which the files were changed.
         2. You can also specify the files you're interested in, and
            ls will list the information about them only.
                           Example:  ls -l junk
            will produce one line of information pertaining  to  the
            file named junk.
         3. As you saw in the last section, "wild card"  expressions
            may  be  substituted  for  filenames.  Thus, "wild card"
            expressions may also be used in this command.  To illus-
            trate,  suppose  you wish to determine which files exist
            in your directory that have ".g"  as  the  ending.   The

                                - 60 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

            following command could be used:
                                ls *.g
         4. If you list all the files in  your  directory,  you  may
            notice  the names of some files you didn't create--these
            have been put in your directory by Unix.
         5. "lsm" is a version of 'ls' which places the filenames in
            rows on the terminal instead of in one long column.

   Let's practice listing filenames.  Do the following exercises.

        _E_X_E_R_C_I_S_E_S



    1.  Use the list command to determine which files  are  in  your
        directory (display names only).

    2.  Do #1 again, except have  the  names  appear  in  descending
        order.

    3.  List all information pertaining  to  your  files,  not  just
        names, in descending order.

    4.  List all files whose name begins in 'junk' followed  by  any
        single character.

    5.  Repeat any exercises that gave you difficulty.

























                                - 61 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _D_e_l_e_t_i_n_g _F_i_l_e_s


        Once you have no further use of a file  it  can  be  deleted
   from  your  directory by using the "Remove Command" which has the
   following form:

                         rm <filename>

                      Example: rm junk

   will delete the file "junk" from your directory.


        _D_e_l_e_t_i_n_g _S_e_v_e_r_a_l _F_i_l_e_s


        Unlike some other systems which limit  their  users  to  the
   tedious  task  of issuing the same command several times in order
   to delete several files UNIX allows you to accomplish  this  feat
   by a single command:

               % rm file1 file2 file3 ...  file'n'

   Of course "wild card" expressions can be  used  to  simplify  the
   command.

   Example:

   % rm chap*  Will delete all files beginning in  "chap."  Since  a
               "wild card" is being used in the "Remove" command, it
               could result in the deletion of several files.  As  a
               precaution,  the  system  will ask you to confirm the
               deletions by  displaying:  glob[confirm].   You  will
               enter  a  "y"  if you still want these files deleted.
               Otherwise, the command will be ignored.

               Here is  a  question  to  check  your  understanding.
               Which files would this command delete?

                              % rm *


               You're right if you said all of your  files  will  be
               deleted.

   Caution:    Before deleting a file, be certain that it is a  file
               you  no  longer need. However, don't become over cau-
               tious and, like the proverbial  "string  saver"  keep
               everything.

                                - 62 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _C_o_m_p_a_r_i_n_g _F_i_l_e_s


        Unix allows you to compare files for similarities or differ-
   ences.  The following two commands are used for this purpose.


    1.  _c_m_p

       ----This command compares  two  files  for  similarities.  No
           response  is  made  if  the files are identical.  If they
           differ, the system displays the position  number  of  the
           character  and  the  line  number at which the difference
           occurred. The form of the command is :

                          cmp <file1> <file2>

                       Example: cmp chapt1 chapt2

           In response, the system would display  something  similar
           to this:

                   chapt1 chapt2 differ: char 5, line 1




























                                - 63 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

    2.  _d_i_f_f

    ----This command is very similar to the "cmp" command.  It  also
        locates differing lines in comparing files.  Its form is:

                     diff <file1> <file2>

            Example: diff chapt1 chapt2

        In  this  case,  the  system  will  compare  "chapt1"   with
        "chapt2."  If  the files are not identical, the line numbers
        and the  statements  that  differ  in  both  files  will  be
        displayed.

             response: 1,5c1,9
                       <
                       <  <lines that differ in file1>
                       <
                       ------
                       >
                       >  <lines that differ in file2>
                       >

   Note:  If the lines that  differ  are  scattered  throughout  the
          files,  then  you  will see several of the above responses
          --- one each time another line is encountered  in  file  1
          that  differs  from  file 2.  "1,5c1,9" indicates the line
          numbers of the statements that  differ;  "1,5"  refers  to
          file  1, and "1,9" refers to file 2, ie. lines 1-5 of file
          1 differ from lines 1-9 of file 2. This really  refers  to
          the type of commands that one would use in the text editor
          to modify one file so as to make it into another.




















                                - 64 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _C_h_a_n_g_i_n_g _F_i_l_e _M_o_d_e_s


        _A_c_c_e_s_s _P_r_i_v_i_l_e_g_e_s


        Every person who uses the   system  has  two  identification
   names  ---  a user identification which is your login name, and a
   group identification which is the designator  of  the  group   in
   which you are assigned, for example:  E53 or R43.

        When a file is created the system  assigns  specific  access
   privileges  to  the owner (you), the owner's group, and all other
   users.

        There are three access privileges associated  with  a  file.
   The  permission  to  read,  to write, or to execute a file may be
   granted or denied a user.  Therefore we refer to these  capabili-
   ties as privileges.

        Now, let's explain what is meant by the above.   To  read  a
   file  means  being  able to display or to copy a file; to write a
   file means being able to delete, to change or to modify  a  file;
   to  execute  a file refers to the execution of an object file; If
   you don't understand what "execute a  file"  means,  don't  worry
   about  it.   You  will  have no need to use this privilege during
   this course.

        These privileges are given to other users by you, the owner.
   This  affords  some means of security protection for your file as
   you determine who has access, as well as the sort of access  oth-
   ers have to your file.


        _c_h_m_o_d _C_o_m_m_a_n_d


        When the file is initially created, the owner has  read  and
   write  privileges,  and  all  other  users  have  only  the  read
   privilege.  We refer to the privileges assigned as  the  mode  of
   the  file.  Now, in order to change the mode of a file, you would
   use the following command:

                  chmod   [-id] <mode> <filename>







                                - 65 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        Whether or not the -id option is used depends upon just  how
   many  accesses you have to change. If you only plan to change the
   privileges for one category of  users,  you  might  use  the  -id
   option,  which identifies the users to whom the access privileges
   are given:

           _I_d              _r_e_f_e_r_s _t_o:

           o                owner
           g                group
           a                all users (owner, group, other users)
           p                public (other users)

   Note: Only the o, g, a, or p is specified.

        The number designation for the various access modes  depends
   on  how  the  chmod command is issued. If the -id option is used,
   the mode is a single digit. If the command is  issued  without  a
   -o,  -g  -a, or -p, then the numbers of the mode range from octal
   000 to 777.

          _M_o_d_e                  _M_e_a_n_i_n_g--_U_s_e_d _w_i_t_h _t_h_e -_i_d _o_p_t_i_o_n
           0                No access
           1                Execute access
           2                Write access
           3                Execute and write access
           4                Read access
           5                Read and execute access
           6                Read and write access
           7                Read, write, and execute access


          _M_o_d_e                  _M_e_a_n_i_n_g--_U_s_e_d _w_i_t_h_o_u_t -_i_d _o_p_t_i_o_n
           400              Readable by owner
           200              Writable by owner
           100              Executable by owner
            40              Readable by owner's group
            20              Writable by owner's group
            10              Executable by owner's group
             4              Readable by all users
             2              Writable by all users
             1              Executable by all users









                                - 66 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _A_s_s_i_g_n_i_n_g _t_h_e _M_o_d_e


        First determine which of the three privileges  you  wish  to
   assign to yourself, your group, and all others.  Now decide which
   form of the command you wish to  use--with  or  without  the  -id
   option.  Although the command issued without the -id option seems
   more complicated, it does have its advantages.  It is unlike  the
   chmod -id command, where the privileges for the different indivi-
   duals must be assigned in separate commands.  Privileges for  all
   users, and all combinations of access can be assigned in one com-
   mand, by adding the numbers of the of the desired  access  modes.
   For  example,  suppose  you  want to set the access codes on your
   file, chap1, so that it is readable and writable for  the  owner,
   as  well as for the owner's group.  The command would be:   chmod
   660 chap1.  Why 660?  400 (owner readable) +200 (owner  writable)
   +40 (group readable) +20 (group writable).  This would have taken
   two separate commands with the -id option.  Here is another exam-
   ple,  suppose you wanted to make the file readable, writable, and
   executable by all users, either of the following  commands  would
   do it:

                  % chmod -a7 chap1   or % chmod 777 chap1.

   Note:  DO NOT space between the <-id> and the <mode>.   Also,  if
          the  <-id>  is  accidently left unspecified, then the mode
          will take on very different values, e.g.:

                         % chmod 7 junk

          will give  read, write, and execute  privileges  to  other
          users  but no access to yourself.  This may be inadvisable
          for sensitive files.

          Whereas:

                         % chmod -g7  junk

          will give only the owner's group, read, write, and execute
          privileges  without  destroying the assigned privileges of
          the other users.

   Note: The previous example demonstrates just what kind of trouble
         can  result  from  mixing up the form of the chmod command.
         Be careful when you change the mode of  access  privileges!
         Use  the  ls to check privlidges after using the chmod com-
         mand.




                                - 67 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _D_e_t_e_r_m_i_n_i_n_g _F_i_l_e _P_r_i_v_i_l_e_g_e_s


        To determine which privileges are  currently  assigned,  use
   this form of the "List" command:

                            ls -l

   which produces something similar to:

                            -rwxr-xr--

        This is the only portion of the line produced from the  list
   command that is of interest at this time.

        The  first "-" indicates that this is a file. If it were not
   a file, it would be a directory and a "d" would appear here.  The
   next three characters represent the owner's  privileges  (  read,
   write,  and  execute),  the  next  three characters represent the
   owner's group privileges ( read, and execute), and the last three
   characters  represent  the  privileges  shared by all other users
   (read).

        Okay, try this: write the command to assign  the  read  only
   privilege to all users of the 'junk' file.


   Answer: % chmod -a4 junk

        If this is also your answer --- very good.  You may continue
   to  the exercises, otherwise please review this section. The sys-
   tem normally assigns a  "default"  permission  to  each  file  it
   creates.  This should be mode 750 (rwxr_x___) or 640 (rw_r_____).
   This is to protect you from having your files  accidently  "read"
   by  snoopers  or  unfriendly  people. If you wish to share a file
   with someone, you may have  to  change  the  mode  of  the  file.
   Remember,  however, that if the "sharer" can read it so can other














                                - 68 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX

   people.

        _E_x_e_r_c_i_s_e_s



    1.  Determine which privileges have been assigned to  you,  your
        group, and other users for one of your files.

    2.  Change the mode to reflect the following:
            a.  You, the owner, have read and execute privileges.
            b.  Your group has read and write privileges.
            c.  All other users have the read only privilege.

    3.  Verify that the changes were made.

    4.  Reassign the original privileges.                  .

    5.  Practice any procedure you are unsure of.


   This concludes the instructional sequence for Module III.   Refer
   to  module  objectives  and  decide  whether  you  can do what is
   required.  Review as needed, and then take the Module Test on the
   following page.



























                                - 69 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


                        _M_o_d_u_l_e _I_I_I _T_e_s_t

   Directions: Answer the following questions without  aids  of  any
   kind. Minimum passing score is 9 out 12 correct.



    1.  The ----------- command is used to create a file.

    2.  The command: % cat junk, will:
            a.  create the file, junk.
            b.  display the file, junk
            c.  delete the file, junk.

    3.  The command:  % cat j1 > j2, will:
            a.  copy j2 into j1.
            b.  copy j1 into j2.
            c.  concatenate j1 to j2.

    4.  -------------- is the command which could be  used  to  con-
        catenate  two  files  (j1  and  j2) to form the a file named
        "temp."

    5.  What  does  the  command:   %   cat   j1   >>   j2   ,   do?
        __________________________________________

    6.  The __________ command  is  used  to  place  headings,  page
        numbers, etc. in your output.

    7.  Assume you are using the "pr" command  to  output  the  file
        "junk."  Write the command to suppress the heading.

    8.  Write the command which could  be  used  to  obtain  a  line
        printer  listing  (paper)  of the table of contents for your
        directory.

    9.  Write the command used to  delete  all  files  beginning  in
        "junk" from your directory._______________________

   10.  Write the command used to  display  any  file  beginning  in
        "page" and ending in 1, 2, 3, or 4. ______________

   11.  Write the command used to compare  two  files,  "junk1"  and
        "junk2,"      to      determine     how     they     differ.
        ______________________________

   12.  Write the command used to give all users  the  read,  write,
        and execute privileges with the "junk" file.



                                - 70 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


                  _A_n_s_w_e_r_s _t_o _M_o_d_u_l_e _I_I_I _t_e_s_t

    1.  The _c_a_t command is used to create a file.

    2.  The command: % cat junk, will _d_i_s_p_l_a_y _t_h_e _f_i_l_e, _j_u_n_k.

    3.  The command, % cat j1 > j2, will _c_o_p_y _t_h_e _f_i_l_e _j_1 _i_n_t_o _j_2.

    4.  % _c_a_t _j_1 _j_2 > _t_e_m_p is the command used to concatenate j1 and
        j2 to form the file, temp.

    5.  The command, %cat j1 >> j2, _a_p_p_e_n_d_s _j_1 _t_o _t_h_e _e_n_d _o_f _j_2.

    6.  The _p_r command is used to place headings, page numbers, etc.
        in your output.

    7.  % _p_r -_t _j_u_n_k is the command used to suppress the headings.

    8.  % _l_s -_l|_o_p_r will produce a listing of the table of  contents
        for your directory.

    9.  % _r_m _j_u_n_k* will delete all files  begining  in  "junk"  from
        your directory.

   10.  %_c_a_t _p_a_g_e[_1_2_3_4] _o_r % _c_a_t _p_a_g_e [_1-_4] will display any file in
        your directory begining in "page" and ending in 1,2,3,or 4.

   11.  % _d_i_f_f _j_u_n_k_1 _j_u_n_k_2 is the  command  used  to  determine  how
        "junk1" and "junk2" differ.

   12.  % _c_h_m_o_d -_a_7 _j_u_n_k _o_r % _c_h_m_o_d _7_7_7 _j_u_n_k is the command used  to
        give  all  users  the read, write and execute privlidges for
        the file "junk."


   If you have answered more than  3  questions  incorrectly  please
   review this module.














                                - 71 -
   Unit I                                                 Module III







   MP119                                        Introduction to UNIX


        _M_o_d_u_l_e _I_V --- _U_t_i_l_i_t_y _p_r_o_g_r_a_m_s

   This module covers Unit I, objective 11.

   Upon completion of this module you will be able to:



    1.  Determine whether or not a specified string of characters is
        present within a file.

    2.  Determine the number of times a specified string of  charac-
        ters appears within a file.

    3.  Determine which lines within  a  file  contain  a  specified
        string of characters.

    4.  Display all lines within a file not containing  a  specified
        string of characters.

    5.  Sort files consisting of character/numeric information.

    6.  Sort by fields or columns.

    7.  Sort upper-case and lower-case characters separately.

    8.  Segment or divide a file.

    9.  Check your file for spelling errors.

   10.  Communicate with another computer on the network.




















                                - 72 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX


        _S_e_a_r_c_h_i_n_g _a _F_i_l_e


        You may be faced with the task of determining whether or not
   a  certain  character  or  pattern  of characters exists within a
   file.  If so, you may accomplish this task by  merely  issuing  a
   command, rather than tediously scanning the file.  The command to
   use is:

                  grep [-v] [-c] [-n] [-f] expression [file]

   "Grep" searches the specified file for lines matching the  speci-
   fied expression.

                  Example:  % grep "cases" junk

        This is the "grep" command in its simplest form.  The system
   will  search  the  file  "junk"  for the expression "cases."  All
   lines containing this expression will be displayed on the  termi-
   nal.

        Let's take a closer look at "grep" by determining what bene-
   fits may be derived by specifying the various options.

   -v             Causes all lines not containing  the  "expression"
                  to be displayed. For example:

                            % grep -v "cases" junk

                  will display all lines except those  displayed  in
                  the above example.


   -c             If you are not interested  in  viewing  the  lines
                  containing  the  "expression,"  but are interested
                  only in determining the number of lines  in  which
                  the  "expression"  exists,  your  problem  can  be
                  solved by specifying this option:

                            grep -c "cases" junk

                  In this situation,  a  number  will  be  displayed
                  indicating  the  number  of  lines within the file
                  which contain the "expression" cases.







                                - 73 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

   -n             This option not only causes the matching lines  to
                  be  displayed,  it  also  prints  the line number.
                  This can be used to determine  exactly  where  the
                  matching lines occur within the file.

                            Example:  grep -n "cases" junk

                            Response: 4: if ... cases ...
                                      20: rare cases ...


   -f             Displays the line containing the first  occurrence
                  of the "expression" only.

        _E_x_p_r_e_s_s_i_o_n_s


        Let's determine how flexible the system allows you to be  in
   forming  the  "expression."  First of all, an expression may be a
   single character or several  characters  delimited  by  quotation
   marks.  Double or single quotes may be used.

   Example:

                     % grep -c "\.$" junk

   will cause a count  of  the  lines  ending  in  a  period  to  be
   displayed.  This feature could be used to determine the number of
   sentences within a file.   As  you  have  probably  deduced,  the
   "\.$"    means   the  end  of  each  line  is  searched  for  the
   expression ".".   The "." has a special meaning to "grep;" there-
   fore,  if   it   is  to  be  considered  as text, it must be pre-
   ceded by a backslash.  Here is a second example:


                     % grep "^if"  junk

        The symbol (^) is called a  circumflex  and  indicates  that
   only  the  beginning  of  the  line is searched for the indicated
   "expression."  What would be the result  of  the  above  command?
   Write your answer in the space provided.



        If you answer is, all lines  beginning  with  "if"  will  be
   displayed, very good.  Here is still another example:

                     % grep -v "[aeiou]" junk




                                - 74 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

        The brackets have  a  similar  meaning  as  when  they  were
   referred to as a "wild card." They can be used to form "character
   classes," wherein each line is searched for the occurrence of any
   one  of  the  characters  within  the  brackets.   What  will  be
   displayed after the above command is entered?  Write your  answer
   here.



   Did you say any lines not containing a vowel?  If so,  excellent.
   Continue on to the exercises.

   Note: All characters searched for must be  explicitly  specified.
         "[a-z]"  means  to search the characters "a," "-," and "z;"
         not the characters a thru z.   Look  at  this  note  again,
         because  the use of "[a-z]" here is not the same as for the
         true "wild card," where "[a-z]" means  to  search  for  the
         characters a through z.  For example:

                           $, ., ^, *

         can be used in conjunction with the  brackets.   They  have
         the  same  meanings  as they did as "wild card" characters,
         for example: "[abc]$".  They are placed outside the  brack-
         ets.  Otherwise, they lose their special meaning.

        _E_X_E_R_C_I_S_E_S



    1.  Determine the number of lines there are within one  of  your
        files containing the word "the."

    2.  Determine which lines  within  the  file  contain  the  word
        "the."

    3.  Display all lines that weren't displayed in #2.

    4.  Determine the number of lines beginning in "a" or "I".

    5.  Determine whether or not any lines end in "?."

    6.  Need more practice?  If so, determine which lines begin with
        "A".  Also, find out how many lines end in a period.








                                - 75 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX


        _S_o_r_t_i_n_g _F_i_l_e_s


        Unix also allows you to place information in your  files  in
   sorted order.  The system performs a character sort unless other-
   wise specified.  The lines are compared two at a time.  First the
   lines  are  left  adjusted, then the first character in line 1 is
   compared with the first character in  line  2,  then  the  second
   characters in both lines are compared, etc.  This continues until
   two characters are encountered that are not the same.  The system
   then  determines which has the lowest assigned value according to
   the following collating sequence:

                  Lowest-----Special Characters
                     |
                     |       Numeric Characters
                     v
                  Highest----Alphabetic Characters

   The two lines are placed in their proper positions and  the  sort
   continues in this manner until the entire file has been placed in
   sorted order.  One file or several files may be sorted in a  sin-
   gle command.

                  Example:  Sort <file1> <file2>

   This would form one file by concatenating "file 1" and  "file  2"
   together,  then  the  newly  formed  file  would be sorted in the
   manner stated above and displayed at the terminal.

   Example:"grade-list-11" contains the names and  organizations  of
           persons who are grade 11.

                       Anna Lou Cross L02
                       Richard Roundtree E54
                       Spikey Green G35
                       Richard Anderson M23

           "grade-list-12" contains the names and  organizations  of
           persons who are grade 12.

                       Howard Longbottom W41
                       Sarah Rightnow R43
                       Bryon Coffee T62







                                - 76 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

   If "% sort grade-list-11 grade-list-12" is  entered  the  results
   displayed on the terminal will be:

                       Anna Lou Cross L02
                       Bryon Coffee T62
                       Howard Longbottom W41
                       Richard Roundtree E54
                       Sarah Rightnow R43
                       Spikey Green G35

        _S_o_r_t _O_p_t_i_o_n_s


        Several options are also available to be used  in  the  sort
   command.  The full form of the sort comand is:

                  sort [-adnrtx] [+pos]...[-mo][name]...

   Now for a more detailed discussion of the various options:


   OPTION         RESULTS
   ______         _______


   a              Permits you to sort lower  case  letters  separate
                  from  upper-case  letters.   The  lines containing
                  upper-case letters will be  displayed  before  the
                  lines containing lower-case letters.

                  _N_o_t_e: The  system  makes  no  distinction  between
                  upper and lower case letters unless this option is
                  specified.

                  To illustrate, suppose you've entered the command:

                  "% sort -a Junk," and "Junk" contains

                            Now is the time
                            for all good men
                            To come to the aid
                            of their country.


                  The results would be:

                            Now is the time
                            To come to the aid
                            for all good men
                            of their country


                                - 77 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

   d              Referred to as  the  "Dictionary  order."  Special
                  characters are ignored in making comparisons, only
                  letters, digits, and blanks are significent.

                  Example: Suppose the following  lines  were  being
                  sorted:

                  % Sort -d Junk, and "Junk" contains:

                          $The time is now ...
                          Don't lose this opportunity.

                  The results would be:

                          Don't lose this opportunity
                          $The time is now ...

                  You will notice that the value of the "$" is  less
                  than the value assigned to"D," and would have been
                  placed before the "D" had not the  d  option  been
                  specified.


   n              Will cause the system to  do  a  numeric  sort  as
                  opposed to doing a character sort.  A numeric sort
                  is performed on  data  consisting  of  digits,  an
                  optional  minus  sign,  and  an  optional  decimal
                  point.The data will be stored  by  its  arithmetic
                  value.

                  For instance, you are sorting a file named 'digit'
                  consisting of:

                                   234.50
                                   110
                                    83
                                 -5243

                  and you entered: % sort -n digit, the results will
                  be:

                                 -5243
                                    83
                                   110
                                   234.50







                                - 78 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

                  On the other hand had you entered "%  sort  digit,
                  the results would have been:

                                 -5243
                                   110
                                   234.50
                                    83

                  because a character  sort  would  have  been  per-
                  formed.


   r              Will reverse the sense of comparisons; i.e., place
                  the  data  in descending order.  This option works
                  as follows:

                  Suppose you are sorting the previous  "junk"  file
                  and

                            % sort -r -n digit

                  is entered, the results will be:

                                   234.50
                                   110
                                    83
                                 -5243

                  As you can see from the above example, the options
                  may  be  combined.  The  order  in  which they are
                  specified isn't important.

   tx             This option allows you to establish fields  within
                  your input lines.  The system will then use only a
                  specified portion of the line in  making  compari-
                  sons instead of the whole line.

                  "x" is used to separate the different fields,  and
                  is any character of your choice except a character
                  that appears in the data.  Suppose you  wished  to
                  create  a  file  consisting  of  three data items:
                  name, social security number and grade.

                  Let's go a step further and assume that  you  were
                  told  that  copies  of  the  file in sorted order,
                  based on each of the three items were needed.

                  How would you construct the file?




                                - 79 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

                  One solution would be to  create  three  different
                  files  having  each item appearing at the begining
                  of the line. This, of course,  would  not  be  the
                  most  efficient  solution.   You  would be wasting
                  time and storage space.  Instead  you  would  con-
                  struct your file as:

                          name/social security no./grade

                  thus dividing the  input  into  fields.   The  "/"
                  represents the field separator, e.g.

                          sort -t/ employee

                  will sort the "employee" file by name field only.

                  _S_o_r_t _f_i_e_l_d _s_p_e_c_i_f_i_c_a_t_i_o_n

                       If your file has been separated into  fields,
                  you  may specify any one of the fields as the sort
                  field.  That is, you can have the data placed in a
                  certain  order based on the values of one particu-
                  lar field only.

                       The "[+pos]" option is used for this purpose.
                  This  option indicates the number of fields before
                  the sort field.

                            Example:  sort -t/ +1 employee

                  will sort the file 'employee' based on the  values
                  of  the  second field (social security no.).  Sup-
                  pose the file contained:

                                 Smith/221-46-1244/11
                                 Jones/114-53-1000/09
                                 Brown/332-24-0244/12

                  The ordered file would appear as:

                                 Jones/114-46-1000/11
                                 Smith/221-46-1244/11
                                 Brown/332-24-0244/12
                  Now, let's expand the file to include a field  for
                  the person's organization designator.

                                 Smith/221-46-1244/11/E23
                                 Jones/114-53-1000/09/E21
                                 Brown/332-24-0244/12/E53

                  This time  the  file  should  be  ordered  by  the

                                - 80 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

                  organization  field.   You would form your command
                  as:

                                 % sort -t/ +3  employee

                  Note: More than one sort field may  be  specified;
                  the file will be ordered by the first field speci-
                  fied and reordered by  a  subsequent  field/fields
                  only if the values in the primary field are equal.

                  Example:  You are to sort the  following  file  by
                  grade and name:

                                 Smith/11
                                 Jones/09
                                 Brown/12
                                 Common/11

                  and you enter: % sort -t/ +1 +0 employee

                  would yield:

                  1st ordering---Jones/09
                                 Smith/11
                                 Common/11
                                 Brown/12

                  2nd ordering---Jones/09
                                 Common/11
                                 Smith/11
                                 Brown/12


   m              Is used to merge files that are already sorted.

                       Example:  % sort -m (file1) (file2)

                  will merge and sort  "file1"  and  "file2."   It's
                  purpose  is  to  tell sort that it does'nt have to
                  re-sort the files just merge them.


   o              Is used to indicate that the  results  are  to  be
                  placed  into a file rather than being displayed on
                  the terminal.

                       Example:  % sort -o (file1) (file2) (file3)

                  The system will sort "file2" and "file3" and place
                  the results into "file1."  Nothing is displayed on
                  the terminal. If this option is used, how can  you

                                - 81 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

                  display the results at a later time? Answer in the
                  space provided.  (Show your will power and  resist
                  peeking at my answers.)


                  If your answer is one of the following, very good!
                               (a) % cat (file1)
                               (b) % pr (file1)
                               (c) % opr (file1)
                               (d) % br (file1)

                  Note: The sort command  may  be  also  used  as  a
                  filter.   For example, "% cat (file1) (file2)|sort
                  -r" will cause, "file1" and  "file2"  to  be  con-
                  catenated  together,  sorted  in descending order,
                  and displayed on  the  terminal.  Could  you  have
                  accomplished  the  same  results by using only the
                  sort command? If you think it  is  possible  write
                  the command below.


                  Yes, % sort -r (file1) (file2),  would  accomplish
                  the same results.

                  Note: Usort is also a sort command and it is  used
                  exactly  as  the  sort  command  except that after
                  everything is  sorted  it  removes  all  duplicate
                  lines.
























                                - 82 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX


        _E_x_e_r_c_i_s_e_s


        I've provided some exercises that give you practice in sort-
   ing files. Do these now.


   1. Construct a file consisting of the following lines of informa-
      tion:

                          -2301
                           99
                           53.25
                           8

      Sort the file in descending order.


   2. Construct the "employee" file, discussed earlier. Sort  it  by
      organization and grade.


   3. Use the file in #2.
      (a) Sort it by grade and social security number.
      (b) Place the results in a file called "holdsort."
      (c) Display "holdsort."

        _S_e_g_m_e_n_t_i_n_g _a _F_i_l_e


        A file may be segmented by dividing it into "n" parts.   You
   are  probably  wondering  why  this  would  be done.  Well, there
   exists an extremely large file, one that requires too  much  time
   to  be listed in one sitting; you could then divide the file into
   two parts and list each part as it is needed.  Or suppose you are
   only interested in a portion of the file.  Why bother to list the
   entire file, scan to loacte the portion you're interested in, and
   then  discard  the remainder?  Even more important, some programs
   and commands will not work with large very  files;  such  as  the
   "opr" (off line print) command. Also, the UNIX editor cannot han-
   dle very large files.










                                - 83 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX


        I'm sure you can probably think of some  other  reasons  for
   using this feature.

        The "split" command is used to perform the above;  its  form
   is:

                  % split -[n] [file] [name]

   where [n] indicates the number of lines each part of the file  is
   to have; [file] is the name of the file to be divided; and [name]
   is the prefix of the file names to hold the results.  The  system
   will  append  "aa" to [name] lexigraphically for as many files as
   is needed to hold the  results.   Don't  let  "lexicographically"
   overwhelm  you.  It just means "as in a dictionary."  The results
   would look like this:  [name]aa, [name]ab, [name]ac, etc.

        If [name] isn't specified, the system uses "x" for [name].

        Let's assume that you have a file, "junk," containing  3,569
   lines and you enter the command:

                       %split -1000 junk

   The file "junk" will be divided into files; xaa,  xab,  xac,  and
   xad.   Each  file  will contain 1,000 lines with the exception of
   xad which will contain 569 lines.

        Suppose you have  a  file  called  "unit"  containing  3,000
   lines,  and you issue the following command, which files would be
   generated?

                       %split -1500 unit unit

   Put your answer in the space provided.


   ANSWER: unitaa and unitab

        Okay, Good. Now how would you obtain a line printer  listing
   of the file?  Put your answer below.


   ANSWER: Simply use the "opr"  command  in  conjunction  with  the
   newly generated files, e.g. opr unitaa unitab.
   Note: The split command is the reverse of cat.  To  re-combine  a
         file that has been split by the following command:

                          % split -1000 junk

         you simply type in:  % cat x*

                                - 84 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX


        _S_p_e_l_l _C_o_m_m_a_n_d


        The "spell" command may be used  quite  beneficially,  espe-
   cially if you frequently misspell the more common everyday words.
   This command is used to have the system check your file for these
   misspelled words.  The form of the command is:

                       spell [-v] <filename>

        "Spell" collects the words from your file, and looks them up
   in  the  system's dictionary.  The misspelled words are displayed
   on the terminal.  "-v" causes asterisks to  be  displayed  beside
   all words containing an apostrophe s ('s).

        This program is not  a  panacea  for  the  misspelled  word.
   First, the file is not being compared against all words, just the
   words in the system's dictionary.  Next, your misspelled word may
   be  a valid word, suppose you type "form" for "from."  The system
   would not recognize your mistake. Finally, spell only  lists  the
   words; it does not tell you where in the file they are located.

        Even with these limitations, you will still find the "spell"
   command to be a useful tool.

        _N_e_t_w_o_r_k_i_n_g --- _T_e_l_n_e_t


        Networking is being able to communicate with  other  systems
   via your system.  UNIX uses "telnet" to achieve this.

        Telnet is a recently implemented feature on UNIX.  It allows
   you  to  communicate with a remote time sharing system across the
   network; that is, you may use the  ELROND  system  to  manipulate
   files  and  to  communicate  with  users on other systems such as
   CARONA.

        In order to access another system, you must have an  account
   on  that  system  and have network privileges.  To obtain network
   privileges, contact operations or your system  administrator.  To
   access "telnet":

                       Type: % telnet

              Response: Unix user telnet -- version 4.0 (I1.37)

                        ^




                                - 85 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

        Notice the circumflex (^); telnet uses this  symbol  as  the
   "prompt" symbol instead of "%."

        Next let's determine which systems are available for commun-
   ication by typing:

                            hosts

        The system responds by displaying a list of the  other  sys-
   tems which can be accessed through ELROND, as follows:


           anyhost^     tasb^       ibm90c^       nas4^      nsf^

           ibm90B^      ibm90a^     step2^        carona^

        If you have the network privilege and an account on  one  or
   more of the above systems, you're ready to communicate across the
   network.  The "conn" (connect) command connects your terminal  to
   the specified system, e.g.

                 Type:      conn carona

             Response:      attempting connection to carona
                            connection open
                            (linemode)
                            Carona  Network Server Telnet

                            CARONA -- UNIX 6th Ed.
                            login:
                            password:


        Type the appropriate login name and password  and  you  have
   access  to  the  CARONA system.  You may use any of the UNIX com-
   mands you used on the ELROND system.

        Did you notice  that  your  password  was  visible?   That's
   because  Telnet  placed your terminal in the line mode.  In order
   for your password to appear invisible, your terminal must  be  in
   the  character  mode  and  have the line echo feature suppressed.
   This is obtained by typing:

                            ^tenex

   before entering your password.

        To return to ELROND simply type:

                            ^bye


                                - 86 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX

        Should you want to access one of the  other  systems  before
   returning  to ELROND, you can by disconnecting your terminal from
   CARONA and re-entering the "conn" command, e.g.:

                            ^close

   will return control to Telnet disconnecting you from  the  CARONA
   System.  You would next type:

               ^conn <whichever system you want to access>


        There are several options which may be used with the  Telnet
   program.   To  obtain  the  full  documentation  of  the program,
   transfer to the ELROND system and type the following:

                       % man telnet|opr

        It's practice time again.  Do the following exercises.

        _E_x_e_r_c_i_s_e_s

    1.  Divide one of your files into 3 separate files.

    2.  Look at the table of contents for your directory  to  deter-
        mine the names of the files holding the results of #1.

    3.  Display the middle portion of the file.


   This is the end of the instructional sequence for Module IV.   Go
   back  to the objectives for the module and decide whether you can
   perform as required.  If so, go on to the Module Test on the next
   page.  If not, review the appropriate sections.


















                                - 87 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX


                            _M_o_d_u_l_e _I_V _T_e_s_t

   Directions:  Answer the following questions without  aid  of  any
   kind. Minimum passing score is 5 out of 8 correct.

   ****** Use the file, "junk," for the questions below.



    1.  The ___________ command is used to search a file.

    2.  Write the command used to determine the number of lines that
        are terminated by either a "." or a "?".

    3.  Write the command used to display the  line  containing  the
        first occurrence of the word "symbol".

    4.  Write the command used to display all  lines  not  beginning
        with an "a".

    5.  Assume you have a file named "payroll" which consists  of  4
        fields,  the  field separator is a "/". Write the command to
        perform a numeric sort based on  the  values  of  the  third
        field.

    6.  Use the file in #5.  Write the command to perform a descend-
        ing sort on the 1st field.

    7.
            a.  Write a command to sort the  file  named  "special",
                such  that  special  characters  in the file will be
                ignored when the comparisons are made.
            b.  Place the results in a file named "nospec".
                 Note: A single command will accomplish both tasks.

    8.  Given that a file named junk contains 1,300 lines,  evaluate
        the  following command: % split -400 junk temp.  (By "evalu-
        ate" I mean for you to examine what the command  will  cause
        the system to do.)


   Check your answers against those on the next page.









                                - 88 -
   Unit I                                                  Module IV







   MP119                                        Introduction to UNIX


                     _A_n_s_w_e_r_s _t_o _M_o_d_u_l_e _I_V _T_e_s_t

    1.  The _g_r_e_p command is used to search a file.

    2.  % _g_r_e_p -_c "[.?]$" _j_u_n_k is the command used to determine  the
        number  of  lines  that  are terminated by either a "." or a
        "?".

    3.  % _g_r_e_p -_f "_s_y_m_b_o_l" _j_u_n_k is the command used to  display  the
        first occurrence of the word "symbol".

    4.  % _g_r_e_p -_v '_a' _j_u_n_k is the command used to display all  lines
        not beginning with an "a".

    5.  % _s_o_r_t -_t/ -_n +_2 _p_a_y_r_o_l_l is the command used  to  perform  a
        numeric sort based on the values of the third field.

    6.  % _s_o_r_t -_t/ -_r _p_a_y_r_o_l_l is the command used to perform a  des-
        cending sort on the first field.

    7.  % _s_o_r_t -_d -_o _n_o_s_p_e_c _s_p_e_c_i_a_l is the command used to sort  the
        file  "special" such that special characters will be ignored
        and the results will be placed in "nospec".

    8.  The file "junk" will be divided into 4  parts.   The  system
        will generate 4 files, tempaa, tempab, tempac, and tempad to
        hold each of the parts respectively.


   ***Congratulations!  You have completed the material in  Unit  I.
      Review  the  topics  discussed before proceeding to the Unit I
      proficiency test.



















                                - 89 -
   Unit I                                            Commands & Test







   MP119                                        Introduction to UNIX


                       _U_n_i_t _I _U_n_i_x _C_o_m_m_a_n_d_s _S_u_m_m_a_r_y


        Following are the commands we worked with in Unit  I.   They
   are for your future reference and can be used on the Unit I Test,
   which starts on the next page.



    1.  passwd  (password)

    2.  msg (message)

    3.  sndmsg  (send message)

    4.  write <login-name>

    5.  remind <user> ... <mo/da/yr> <hr:min> <-r"reminder">

    6.  cat > (filename)

    7.  cat (filename1) > (filename2)

    8.  cat  (filename)

    9.  cat (filename1) >> (filename2)

   10.  cat (filename1) (filename2) > (filename3)

   11.  pr [-h (header)] [+n] [-t] [-m] (filename)

   12.  opr <filename>

   13.  ls [-l] [-t] [-r] ["

   14.  rm <filename>

   15.  cmp <filename1> <filename2>

   16.  diff <filename1> <filename2>

   17.  chmod <id> <mode> <filename

   18.  grep [-c] [-v] [-n] [-f] "expression" <filename>

   19.  sort [-n] [-r] [-tX] [+pos] [-pos] [-m] [-oNAME] <filename>

   20.  split [-n] [filename] [name]



                                - 90 -
   Unit I                                            Commands & Test







   MP119                                        Introduction to UNIX

   21.  who

   22.  where tty

   23.  date

   24.  name

   25.  br <filename>











































                                - 91 -
   Unit I                                            Commands & Test







   MP119                                        Introduction to UNIX


                       _U_n_i_t _I _P_r_o_f_i_c_i_e_n_c_y _T_e_s_t

   Directions: For the Unit I Proficiency Test, you may use the Unit
   I  UNIX  Commands  Summary Sheet for reference. NOTHING ELSE!  If
   you become tempted to look back, DON'T ! YOU WILL BE ONLY  CHEAT-
   ING  YOURSELF.   You are allowed 30 minutes to complete the test.
   Minimum passing score is 17 out of 21 correct.


    1.  Information is sent to the computer
            a.  a page at a time
            b.  one line at a time
            c.  either a or b

    2.  To halt execution of a command, depress the __________key.

    3.  Corrections are made to an input line
            a.  before you advance to another page
            b.  anytime you want
            c.  before  you depress the Return key

    4.  Write the command to change your password from  what  it  is
        now to "mysecret." ___________________________

    5.  The _____________ program is used to read a message that has
        been sent to you.

    6.  _______________________ is the command used to send  a  mes-
        sage to other users.

    7.  The ________________ command can be used to conduct  a  two-
        way conversation with another user.

    8.  Write the command which could be used to  remind  you  of  a
        meeting scheduled 3 hours from now.

    9.  The "cat" command is used to:
            a.  create a file
            b.  display a file
            c.  append one file to another file
            d.  all of the above

   10.  The command "% cat j1 >> j2" will:
            a.  copy j1 into j2
            b.  display j1 and copy j1 into j2
            c.  append j1 to j2
            d.  none of the above




                                - 92 -
   Unit I                                            Commands & Test







   MP119                                        Introduction to UNIX

   11.  Write a command to print  the  file  "junk"  formatted  with
        header lines on the printer. __________________________

   12.  Write a command to display files  "j1"  and  "j2"  formatted
        without header lines on the printer._____________________

   13.  Write the command used to delete all files from your  direc-
        tory beginning with one of the letters "a-h" followed by any
        character. ________________________________

   14.  Write the command used to display in  descending  order  the
        names  of  all  files  in  your  directory  ending in "bak".
        ________________________________

   15.  The _____________ and ______________ commands  are  used  to
        compare files.

   16.  The command "% chmod 70 junk" will:
            a.  give the read, write, and execute privileges to  all
                users of the file "junk."
            b.  give the read, write, and execute privileges to  the
                owner's  group,  leaving all other users' privileges
                unaltered.
            c.  give the read, write, and execute privileges to  the
                owner's group, removing all privileges for all other
                users of the file "junk."

   17.  Write a command to determine the number of  lines  contained
        within the "junk" file that don't end in a "." (period).

        Evaluate the following commands:


   18.  % sort -t/ -r -n +3 junk|opr

   19.  % sort -a junk|pr -h secret

   20.  % split -1000 junk

   21.  % grep "ach" junk|sort|opr


   ****Please contact your instructor to have your  paper  corrected
       before continuing to Unit II.








                                - 93 -
   Unit I                                            Commands & Test







   MP119                                        Introduction to UNIX


                       _U_n_i_t_I _C_r_i_t_i_q_u_e _S_h_e_e_t


        Our goal is to provide a course that will enable you to per-
   form  your  duties  more efficiently and more effectively; but we
   need your help.

        Please take a few minutes to answer the  questions  on  this
   sheet to help us to determine our weak and strong points.

        Let us know what's wrong, so we can fix it.



    1.  It took me approximately  ________________ hours to complete
        this unit.

    2.  How much experience with the use of computer  terminals  did
        you have before beginning this course?
            a.  plenty
            b.  some, but not much
            c.  none

    3.  What about the difficulty level of the material?
            a.  too hard
            b.  hard, but not impossible
            c.  about right
            d.  easy
            e.  too easy

    4.  How did you like it?
            a.  It was fun.
            b.  It was somewhat enjoyable.
            c.  It was tolerable.
            d.  It was boring.

    5.  What did you think of  each  module;  was  the  presentation
        confusing?

        ModuleI - yes ________    no _________
        If yes, where?________________________________________
        ______________________________________________________
        ______________________________________________________
        ______________________________________________________

        Module II - yes________    no ________
        If yes, where?________________________________________
        ______________________________________________________
        ______________________________________________________
        ______________________________________________________

                                - 94 -
   Unit I                                            Commands & Test







   MP119                                        Introduction to UNIX

        Module III - yes ________    no ________
        If yes, where?________________________________________
        ______________________________________________________
        ______________________________________________________
        ______________________________________________________

        Module IV - yes ________    no ________
        where ________________________________________________
        ______________________________________________________
        ______________________________________________________
        ______________________________________________________

    6.  Do any sections require more explanation?
        yes________        no__________
        If yes, please help by listing them.
        ______________________________________________________
        ______________________________________________________
        ______________________________________________________
        ______________________________________________________

    7.  Were any topics too wordy? ___________
        (please list them)
        ______________________________________________________
        ______________________________________________________
        ______________________________________________________

    8.  Are the objectives clearly stated?___________
        (Please let us know which ones that aren't)
        ______________________________________________________
        ______________________________________________________
        ______________________________________________________

    9.  Does the material cover the objectives? ______________
        (Again we are soliciting your help; tell us which ones
        that aren't being covered.)
        ______________________________________________________
        ______________________________________________________
        ______________________________________________________

   10.  What do you think of the exercises?
            a.  too many
            b.  right amount
            c.  not enough

   11.  How well do  you  think  the  Module  Tests  evaluated  your
        knowledge of the subject matter?
            a.  completely
            b.  adequately
            c.  poorly



                                - 95 -
   Unit I                                            Commands & Test







   MP119                                        Introduction to UNIX

   12.  How well do you think the Unit Test evaluated your knowledge
        of the subject matter?
            a.  completely
            b.  adequately
            c.  poorly

   13.  Please list any further comments or suggestions which  would
        help to improve this unit.
        _____________________________________________________
        _____________________________________________________
        _____________________________________________________
        _____________________________________________________
        _____________________________________________________


   ****Please return this to your instructor; you  do  not  have  to
       sign it.



   THANK YOU FOR YOUR HELP.































                                - 96 -
   Unit I                                            Commands & Test




