HOW TO GET STARTED

This  section  provides  the  basic  information  you need to get
started on UNIX: how to log in and log out,  how  to  communicate
through  your terminal, and how to run a program.  See ``UNIX for
Beginners'' by Brian W. Kernighan for a more  complete  introduc-
tion to the system.  Logging in.   You must call UNIX from an ap-
propriate terminal.  UNIX supports ASCII  terminals  typified  by
the TTY 37, the GE Terminet 300, the Dasi 300, and various graph-
ical terminals.  You must also have a valid user name, which  may
be  obtained, together with the telephone number, from the system
administrators.  The same telephone number serves terminals oper-
ating at all the standard speeds.  After a data connection is es-
tablished, the login procedure depends on what kind  of  terminal
you are using.
     300-baud terminals:   Such terminals include the GE Terminet
     300, most display terminals, Execuport, TI, GSI, and certain
     Anderson-Jacobson terminals.  These terminals generally have
     a speed switch which should be set at ``300'' (or ``30'' for
     30  characters  per  second)  and  a half/full duplex switch
     which should be set at full-duplex.  (This switch will often
     have to be changed since many other systems require half-du-
     plex).  When a connection is established, the  system  types
     ``login:'';  you  type your user name, followed by the ``re-
     turn'' key.  If you have a password, the system asks for  it
     and  turns  off  the printer on the terminal so the password
     will not appear.  After you have logged in, the  ``return'',
     ``new  line'',  or  ``linefeed''  keys will give exactly the
     same results.  TTY 37 terminal:   When you have  established
     a  data connection, the system types out a few garbage char-
     acters (the ``login:'' message at the wrong speed).  Depress
     the  ``break'' (or ``interrupt'') key; this is a speed-inde-
     pendent signal to UNIX that a 150-baud terminal is  in  use.
     The  system then will type ``login:,'' this time at the cor-
     rect speed; you respond with your user name.  From  the  TTY
     37  terminal, and any other which has the ``new-line'' func-
     tion (combined carriage return and linefeed), terminate each
     line  you type with the ``new-line'' key (not the ``return''
     key).
For all these terminals, it is important that you type your  name
in  lower-case  if possible; if you type upper-case letters, UNIX
will assume that your terminal cannot generate lower-case letters
and  will  translate  all  subsequent upper-case letters to lower
case.  The evidence that you have successfully logged in is  that
the  Shell  program  will type a ``%'' to you.  (The Shell is de-
scribed below under ``How to run a program.'')  For more informa-
tion, consult getty(VIII), which discusses the login sequence in
more detail, and tty(IV), which discusses typewriter I/O.   Log-
ging out.   There are three ways to log out:
     You can simply hang up the phone.  You can log out by typing
     an end-of-file indication (EOT character, control ``d'')  to
     the  Shell.   The  Shell  will terminate and the ``login: ''
     message will appear again.  You can also log in directly  as
     another user by giving a login command(I).
How to communicate through your terminal.   When you type to
UNIX, a gnome deep in the system is gathering your characters and
saving  them in a secret place.  The characters will not be given
to a program until you type a return (or new-line), as  described
above in Logging in.  UNIX typewriter I/O is full-duplex.  It has
full read-ahead, which means that you can type at any time,  even
while  a program is typing at you.  Of course, if you type during
output, the output will have the input  characters  interspersed.
However,  whatever  you  type will be saved up and interpreted in
correct sequence.  There is a limit to the amount of  read-ahead,
but  it is generous and not likely to be exceeded unless the sys-
tem is in trouble.  When the read-ahead limit  is  exceeded,  the
system throws away all the saved characters.  On a typewriter in-
put line, the character ``@'' kills all the characters typed  be-
fore  it,  so  typing  mistakes can be repaired on a single line.
Also, the character ``#'' erases the last character typed.   Suc-
cessive  uses  of ``#'' erase characters back to, but not beyond,
the beginning of the line.  ``@'' and ``#'' can be transmitted to
a program by preceding them with ``\''.  (So, to erase ``\'', you
need two ``#''s).  The ASCII ``delete'' (a.k.a. ``rubout'') char-
acter  is  not passed to programs but instead generates an inter-
rupt signal.  This signal generally causes whatever  program  you
are  running  to  terminate.  It is typically used to stop a long
printout that you don't want.  However, programs can arrange  ei-
ther  to ignore this signal altogether, or to be notified when it
happens (instead of being terminated).  The editor, for  example,
catches  interrupts and stops what it is doing, instead of termi-
nating, so that an interrupt can be used to halt an editor print-
out  without  losing  the  file being edited.  The quit signal is
generated by typing the ASCII FS character.  It not only causes a
running  program  to terminate but also generates a file with the
core image of the terminated process.  Quit is useful for  debug-
ging.   Besides adapting to the speed of the terminal, UNIX tries
to be intelligent about whether you have a terminal with the new-
line  function  or whether it must be simulated with carriage-re-
turn and line-feed.  In the latter case, all input  carriage  re-
turns are turned to new-line characters (the standard line delim-
iter) and both a carriage return and a line feed  are  echoed  to
the  terminal.   If you get into the wrong mode, the stty command
(I) will rescue you.  Tab characters  are  used  freely  in  UNIX
source  programs.   If  your terminal does not have the tab func-
tion, you can arrange to have them turned into spaces during out-
put,  and echoed as spaces during input.  The system assumes that
tabs are set every eight columns.  Again, the  stty  command(I)
will  set  or  reset  this mode.  Also, there is a file which, if
printed on TTY 37 or TermiNet 300 terminals,  will  set  the  tab
stops correctly (tabs(V)).  Section tty(IV) discusses typewrit-
er I/O more fully.  How to run a program; the Shell.    When  you
have successfully logged into UNIX, a program called the Shell is
listening to your terminal.   The  Shell  reads  typed-in  lines,
splits  them  up  into a command name and arguments, and executes
the command.  A command is simply  an  executable  program.   The
Shell  looks  first  in your current directory (see next section)
for a program with the given name, and if none is there, then  in
a  system  directory.  There is nothing special about system-pro-
vided commands except that they are kept in a directory where the
Shell  can  find them.  The command name is always the first word
on an input line; it and its arguments are separated from one an-
other by spaces.  When a program terminates, the Shell will ordi-
narily regain control and type a ``%'' at you to indicate that it
is ready for another command.  The Shell has many other capabili-
ties, which are described in detail in section sh(I).   The cur-
rent directory.   UNIX has a file system arranged in a hierarchy
of directories.  When the system administrator gave  you  a  user
name,  he  also  created a directory for you (ordinarily with the
same name as your user name).  When you log in, any file name you
type is by default in this directory.  Since you are the owner of
this directory, you have full permissions to read, write,  alter,
or destroy its contents.  Permissions to have your will with oth-
er directories and files will have been granted or denied to  you
by  their  owners.   As a matter of observed fact, few UNIX users
protect their files from destruction, let alone perusal, by other
users.   To change the current directory (but not the set of per-
missions you were endowed with at login)  use  chdir(I).   Path
names.   To refer to files not in the current directory, you must
use a path name.  Full path names begin with ``/'', the  name  of
the  root  directory  of  the whole file system.  After the slash
comes the name of each directory containing the next sub-directo-
ry  (followed by a ``/'') until finally the file name is reached.
E.g.: /usr/lem/filex refers to the file filex  in  the  directory
lem; lem  is  itself a subdirectory of usr; usr springs directly
from the root directory.  If your current directory has subdirec-
tories,  the  path  names of files therein begin with the name of
the subdirectory (no prefixed ``/'').  Without  important  excep-
tion,  a  path name may be used anywhere a file name is required.
Important commands which modify the contents of files are cp(I),
mv(I),  and rm(I), which respectively copy, move (i.e. rename)
and remove files.  To find out the status of  files  or  directo-
ries,  use  ls(I).  See mkdir(I) for making directories; rmdir
(I) for destroying them.  For a fuller  discussion  of  the  file
system,  see ``The UNIX Time-Sharing System,'' by the present au-
thors.  It may also be useful to glance  through  section  II  of
this  manual, which discusses system calls, even if you don't in-
tend to deal with the system at that level.  Writing a program.
To  enter  the  text of a source program into a UNIX file, use ed
(I).  The three principal languages in UNIX are assembly language
(see  as(I)),  Fortran (see fc(I)), and C (see cc(I)).  After
the program text has been entered through the editor and  written
on a file, you can give the file to the appropriate language pro-
cessor as an argument.  The output of the language processor will
be  left on a file in the current directory named ``a.out''.  (If
the output is precious, use mv to move it to a less exposed  name
soon.)  If you wrote in assembly language, you will probably need
to load the program with library subroutines; see  ld(I).   The
other  two  language  processors  call  the loader automatically.
When you have finally gone through this  entire  process  without
provoking  any  diagnostics,  the resulting program can be run by
giving its name to the Shell in response  to  the  ``%''  prompt.
Next,  you  will need cdb(I) or db(I) to examine the remains of
your program.  The former is useful for C  programs,  the  latter
for  assembly-language.   No  debugger  is much help for Fortran.
Your programs can receive arguments from the command line just as
system  programs  do.   See exec(II).  Text processing.   Almost
all text is entered through the editor.  The commands most  often
used  to  write text on a terminal are: cat, pr, roff, nroff, and
troff, all in section I.  The cat command simply dumps ASCII text
on the terminal, with no processing at all.  The pr command pagi-
nates the text, supplies headings, and has a facility for  multi-
column  output.   Troff  and  nroff are elaborate text formatting
programs, and require careful forethought in  entering  both  the
text  and  the  formatting  commands  into the input file.  Troff
drives a Graphic Systems phototypesetter; it was used to  produce
this  manual.   Nroff  produces  output on a typewriter terminal.
Roff (I) is a somewhat less elaborate  text  formatting  program,
and  requires  somewhat  less  forethought.  Surprises.   Certain
commands provide inter-user communication.  Even if  you  do  not
plan to use them, it would be well to learn something about them,
because someone else may aim them at you.   To  communicate  with
another  user  currently  logged  in, write(I) is used; mail(I)
will leave a message whose presence will be announced to  another
user when he next logs in.  The write-ups in the manual also sug-
gest how to respond to the two commands  if  you  are  a  target.
When  you  log  in, a message-of-the-day may greet you before the
first ``%''.