.bp
.ce
HOW TO GET STARTED
.sp 2
This section provides the basic information
you need to get started on \s8UNIX\s10:
how to log in and log out,
how to communicate through your terminal,
and how to run a program.
See "U\s8NIX\s10 for Beginners"
by Brian W. Kernighan for a more complete introduction
to the system.
.pg
.ul
Logging in.||
You must access \s8UNIX\s10 from an appropriate terminal.
At QMC \s8UNIX\s10 supports \s8ASCII\s10 terminals typified by the ITT 3210
teletype-compatible displays
and the Imlac PDS1 refreshed graphical display
at 9600 baud (almost 1000 characters a second).
There is a dial-up modem line at 300 baud (see
.ul
modem
(IV) for details).
You must also have a valid user name,
which may be obtained from the system administrators.
.pg
To log in, you should look for a terminal
on which the bottom line displayed contains
the invitation "login:"; you type your
user name, followed by the "return" key.
If you have a password, the system asks for it
and turns off the display on the terminal
so the password will not appear.
If you make an error in typing the above, UNIX will respond with
"incorrect login", and invite you to type your user name again.
.pg
It is important
that you type your name in lower-case if possible; if you type
upper-case letters, \s8UNIX\s10
will assume that your terminal cannot generate lower-case
letters and will translate all subsequent upper-case
letters to lower case.
After you have logged in,
the "return", "new line", or "linefeed" keys
will give exactly the same results.
.pg
The evidence that you have successfully
logged in is that the Shell program
will type a "%" to you.
(The Shell is described below under
"How to run a program.")
.pg
For more information, consult
.it getty
(VIII), which discusses the login sequence in more
detail, and
.it tty
(IV), which discusses typewriter I/O.
.pg
.ul
Logging out.||
There are two ways to log out:
.in +5
.pg
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.
.pg
You can also log in directly as another user
by giving a
.it "login"
command (I).
.pg
.in 0
.ul
How to communicate through your terminal.||
When you type to \s8UNIX\s10, 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
.ul
Logging in.
.pg
\s8UNIX\s10 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 system is in trouble.
When the read-ahead limit is exceeded, the system
throws away all the saved characters.
.pg
When you are typing normal terminal input, there are a few characters
that perform
simple editing operations on the input line, and enable you to control
the output of information to the screen.
.pg
The CANCEL character (control-"x")
kills all the characters typed before it, so major typing mistakes
can be repaired by starting the line again.
Less drastically, the RUBOUT character erases the last character
typed, and control-"w" deletes the last 'word' typed.
Successive uses of these special characters will erase back to,
but not beyond, the beginning of the line (a 'bell' is transmitted
when the beginning of the line is hit).
As a confirmation of your action,
the deleted characters are displayed again in square parentheses.
.pg
The control-"c" character is not passed to programs
but instead generates an
.ul
interrupt 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 either 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 terminating, so that an interrupt can
be used to halt an editor printout without
losing the file being edited.
.pg
The
.it quit
signal is generated
by typing the \s8ASCII\s10 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 debugging.
.pg
Output to the terminal is normally "paged". This means that it
stops when a full screen of information has been transmitted.
To start the next "page", type any character (e.g. a space).
the character typed is a "page-turning" character and does not
appear as input to any other program that may be running.
.pg
Besides adapting to the speed of the terminal,
\s8UNIX\s10 tries to be intelligent about whether
you have a terminal with the new-line function
or whether it must be simulated with carriage-return
and line-feed.
In the latter case, all input carriage returns
are turned to new-line characters (the standard
line delimiter)
and both a carriage return and a line feed
are echoed to the terminal.
If you get into the wrong mode, the
.it ter
command (I) will rescue you.
.pg
Tab characters (control-"i") are used freely in UNIX source programs.
Your terminal probably does not have the tab function,
but in normal terminal mode, they are turned into spaces
during output, and echoed as spaces
during input.
The system assumes
that tabs are set every eight columns.
Again, the
.it ter
command (I) will set or reset this mode.
.pg
Section
.it tty
(IV) discusses typewriter I/O more fully.
.pg
.ul
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-provided
commands except that they are kept in a directory
where the Shell can find them.
.pg
The command name is always the first word on an input line;
it and its arguments are separated from one another by
spaces.
.pg
When a program terminates, the Shell will ordinarily regain control and type 
a "%" at you to indicate that it is ready for another command.
.pg
The Shell has many other capabilities, which are described in detail in section
.it sh
(I).
.pg
.ul
The current directory.||
\s8UNIX\s10 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 other directories
and files will have been granted or denied to you
by their owners.
As a matter of observed fact, few \s8UNIX\s10 users
protect their files from destruction,
let alone perusal, by other users.
.pg
To change the
current directory (but not the set of permissions you
were endowed with at login) use
.it chdir
(I).
.pg
.ul
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-directory (followed by a "/") until finally the
file name is reached.
E.g.:
.ul
/usr/lem/filex
refers to the file
.ul
filex
in the directory
.ul
lem; lem
is itself a subdirectory of
.ul
usr; usr
springs directly from the root directory.
.pg
If your current directory has subdirectories,
the path names of files therein begin with
the name of the subdirectory (no prefixed "/").
.pg
Without important exception,
a path name may be used anywhere a file name is
required.
.pg
Important commands which modify the contents of files
are
.ul
\fIcp\fR
(I), 
.ul
\fImv\fR
(I), and 
.ul
\fIrm\fR
(I), which respectively copy, move (i.e. rename) and remove files.
To find out the contents of directories,
use
.ul
\fIfi\fR
(I).
To find out the status of files or directories,
use
.ul
\fIfs\fR 
(I).
See
.it mkdir
(I) for making directories; 
.ul
\fIrmdir\fR 
(I) for destroying them.
.pg
For a fuller discussion of the file system, see
"The \s8UNIX\s10 Time-Sharing System,"
by D. M. Ritchie and K. Thompson.
It may also be useful to glance through
section II of this manual, which discusses
system calls, even if you don't intend
to deal with the system at that level.
.pg
.ul
Writing a program.||
To enter the text of a source program into a \s8UNIX\s10 file,
use the editor 
.ul
\fIem\fR
(I).
The three principal languages in \s8UNIX\s10 are
assembly language (see 
.ul
\fIas\fR 
(I)), Fortran (see 
.ul
\fIfc\fR 
(I)), and C (see 
.ul
\fIcc\fR 
(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 processor 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 
.it 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
.ul
\fIld 
(I).  The other two language processors call
the loader automatically.
.pg
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.
.pg
Next, you will need 
.ul
\fIcdb\fR 
(I) or|
.ul
\fIodb\fR 
(I) to examine the remains of your program.
The former is useful for C programs, the latter
for both assembly-language and C programs.
No debugger is much help for Fortran.
.pg
Your programs can receive arguments from the command line
just as system programs do.
See 
.ul
\fIexec\fR 
(II).
.pg
.ul
Text processing.||
Almost all text is entered through the editor.
The commands most often used to write text on a terminal are:
.ul
cat, pr, roff,
and
.ul
nroff,
all in section I.
.pg
The 
.ul
\fIcat\fR 
command simply dumps \s8ASCII\s10 text
on the terminal, with no processing at all.
The 
.ul
\fIpr\fR 
command paginates the text, supplies headings,
and has a facility for multi-column output.
.ul
nroff
is an elaborate text formatting program,
and requires careful forethought
in entering both the text and the formatting commands
into the input file.
.ul
Troff (not available at QMC)
drives a Graphic Systems phototypesetter;
it was used to produce this manual.
.ul
Nroff
produces output on a typewriter terminal.
.ul
Roff
(I)
is a somewhat less elaborate text formatting
program, and requires somewhat less forethought.
.pg
.ul
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.
.pg
To communicate with another user currently logged in,
.ul
write
(I)
is used;
For more elaborate conversations involving up to four logged-in
users at ITT displays,
.ul
confer
(I).
.ul
send
(I)
will leave a message whose presence will be announced
to another user when he next logs in.
Read your messages with
.ul
mail
(I).
.pg
When you log in, a message-of-the-day may greet you
before the first "%".
