From edo@wharfrat.as.arizona.edu Mon Aug 27 10:04:19 2001
Received: from wharfrat.as.arizona.edu (wharfrat.as.arizona.edu [128.196.209.89])
	by lithops.as.arizona.edu (8.9.1/8.9.1) with ESMTP id KAA02741
	for <jill@lithops.as.arizona.edu>; Mon, 27 Aug 2001 10:04:18 -0700 (MST)
Received: (from edo@localhost)
	by wharfrat.as.arizona.edu (8.9.1/8.9.1) id KAA27637
	for jill; Mon, 27 Aug 2001 10:04:19 -0700 (MST)
Date: Mon, 27 Aug 2001 10:04:19 -0700 (MST)
From: "E. Olszewski" <edo@as.arizona.edu>
Message-Id: <200108271704.KAA27637@wharfrat.as.arizona.edu>
To: jill@as.arizona.edu
Subject: more unix
Content-Length: 47670
X-Lines: 1120
Status: RO

Astronomy 302 Unix Primer   Jan 16, 1997

There's a tiny assignment buried in here, due Jan 29.

The computer ETHEL runs the Unix operating system. You will need
to know a few basic commands to function, AND the more you know
the better your computing life will be. So consider this page the ABSOLUTE
MINIMUM needed for survival.

When you sit down at the PCs in Room 208, you'll be sitting in
a PC environment. To turn the PC into a terminal for ethel, click on
EXCEED. Then go down until you see "ethel" and click on it. You
can then login to ethel given your account name and password.

Once you're logged in, you'll be in what is called your HOME DIRECTORY.
type "pwd" (and carriage return, of course). It will tell you the
name of the directory.

After logging in for the first time, you might want to change your password.
You do that by invoking the "passwd" command. You'll need to answer some
questions, namely, the old and new passwords. Our system managers run password
cracking programs so that they'll find crackable passwords before hackers do.
So we like passwords with mixed case, with a number or weird symbol. They
should be 8 or more characters long, and NOT in a dictionary, NOT the
name of you or your significant other, etc. So "lithops" is not a good
password, but "8LithOps!" is a good one. Make it easy to remember
but hard to crack. THIS IS A BIG DEAL.

Now type the following command:      mkdir test_dir
This command makes (mk) a sub-directory (dir). So if you think of 
directories as trees, your highest level directory (biggest branch) is
the home directory. There are actually higher level directories
above YOU, but we'll get to that later. 

Now type "ls -tl" (without the quotes of course, and with a carriage return
of course). This gives you a listing (ls) of the files in the current
directory. If you want to learn what the switches (-tl in this case) do,
and what your choices are, type "man ls". MAN stands for "manual" or
"help". There are MAN PAGES for all unix commands, but of course you
have to know what the command is, first. I will put a cheat sheet in
room 302. Also, you'll want to refer to the description of the PAGE command
below.

What you'll see is something like
drwxr-xr-x   2 edo      other        512 Jan 16 08:52 test_dir
The "d" stands for the fact that test_dir is a DIRECTORY
rwx means that the OWNER has read, write, and execute privileges
the next 3 spaces are for the "group" (we don't use groups at steward)
the last 3 are the privileges for the "world". So ANYONE can read
this file, and if it were a fortran program anyone could execute it,
but no one besides you can WRITE or MODIFY that file.
It also tells you the size of the file in bytes (512 in this case),
and the time it was last modified, and the name.

Now type "df". This command gives you a list of the disks attached
to ethel, the number of kilo-bytes available, the number remaining, and
how full the disk is. Finally it gives the name of the disk (or
disk partition, they may not be different pieces of hardware). 
The HOME DIRECTORY is also called /d0. DF is a useful command for
seeing how full the disk is.

Now type "cd test_dir". CD stands for change-directory. Now type
"ls -tl", you'll see nothing. Now type "pwd".

Now type "cd .." ".." means to move UP one level, in this case you're
back in the home directory. type "cd test_dir". now type "cd". A naked
"cd" means to go to your home directory. You can also type 
"cd /d0/yourname/test_dir", where yourname is your real account name (first
initial, last name) to go directly to where you want to go. So you can step
through to a directory, or go directly there.

If you want to know how much disk space you're using, you can type
"du -s " (and of course learning the DU man page is useful). By
the way, Unix is CASE SENSITIVE, so i'm being sloppy about the use
of capital letters for emphasis here. Within quotation marks, i'm typing
the commands exactly as they should be. You will learn the total size
in kilobytes of that directory and all below it. Try typing "du -s *"
from your home directory. CD to /d0 and do the same.

What about the laser printer in Room 208? Well, it's your default
printer, and is called lw26. To send a job to the printer (WARNING,
you need to be careful about postscript files, more about that later)
type "lpr filnam" where FILNAM is the actual name of the file. To see
the printer queue, type "lpq" or "lpq -Plw26" (and of course there are man
pages). There are 32 printers currently attached to the Steward computer
cluster, and one COULD send a file to any printer to be printed. You
will not likely need that fact.

You can read or edit a file by saying "emacs filnam". If the filnam
exists, you'll be BOTH reading and editing. If the filnam does not
exist, the file will be created (though not SAVED till you get out
of the editor... more on that later). What if you don't want to
EDIT the file, just read it? Well, there's a unix command called
"page". So you can say "page filnam". It will display a page at
a time on the screen. You go to the next page by hitting spacebar.
you get out of page by either getting to the end of the file, or
by typing "q" (no carriage return). PAGE is a lot more powerful
than that, but you'll have to read the man page (when you say "man something"
you're actually paging the man page).

Well, at this point it would be useful to have a couple of junk files
lying around. So let's make a couple. CD to test_dir. Now type
"emacs junk1". Then type a couple of lines of crap as if it were a typewriter,
ending the last line with a carriage return (all files should end with
a carriage return... obviously the difference between one line and the next
is a carriage return. See what happens when your line is longer than the
screen size, the computer let's you know in a special way.) Get out
of the editor and save the file by typing "cntl-x cntrl-c" where cntl
means to hold down the CONTROL button on the keyboard while typing
the letter, much as you'd hold down the shift key to type a capital
letter. It will ask you a question, answer "y". Make a second file "junk2".

Type "ls -tl". Now type "mv junk2 fred". MV allows you to move or rename
files. Now type "ls -tl". Now type "mv junk1 ..". Type "ls -tl". What
happened to junk1? Type "cd .." Type "ls -tl"

Now type "rm junk1". RM stands for remove or delete.
Now type "rm test_dir". It won't let you do it. Type "rm -r test_dir"
and the directory will go away along with all of the files and subdirectories
within it. If you want a directory with that name "test_dir" you'll
have to remake it. Do that. Of course, it's now empty and the files
that were in it are lost forever.

What about COPYING files? Let's learn that by typing "cp /l/guidelines ."
(since the dot is inside the parentheses it's part of the command).
Type "cp /l/guidelines fred". Type "ls -tl" to see what happened and
to learn the use of the dot. Now RM one or the other and PAGE the one that's
there. There's a lot of stuff you don't need to know, but you'd
might as well read it once, and it's good to know where the guidelines
pages live (on a disk area called /l). This also shows that you
can copy from another person's area and that unless you set protections
others can copy your stuff. You might actually want to set the
protection of your fortran programs to be visible only by you until
i tell you to change the protection so that i can read it. Type
"ls -tl". Then type "chmod 700 filnam" where filnam is some file. Type
"ls -tl". See? Only you have privileges. Type "chmod 777 filnam" and
"ls -tl". For the moment, that will do for chmod.


There's a lot more cool stuff in Unix, but for the moment this will do.
I am appending a more general document to this one. There are a number
of Unix books at the SCIENCE LIBRARY and a couple on reserve in the PARKER
ROOM. One that I like is Unix in a Nutshell, another is Unix Primer Plus.
Once you've learned this tiny amount of vocabulary, both READING
and ASKING will allow you to expand your Unix knowledge.


Ok, since you still have an uncluttered disk, use RM to get it back
to the pristine state. NOW FOR THE ASSIGNMENT. 

Go to your home directory. Make three subdirectories called three
unique names, namely, your first name, your middle name, your last
name. Go to each directory in turn, using emacs to make a file called "test1"
in the first, "test2" in the second, "test3" in the third. Test1
should contain the numbers 1-10, one number per line. Test2
should contain the course numbers of the astronomy courses you've taken.
Test3 should contain the following typing skills stuff..."Now
is the time for all good men to come to the aid of their country.
The quick brown fox jumped over the lazy dog." Change the protections
of the three data files to "700".

Now go to your home directory. Type " ls -tl * >fred". Rather than have
the output of "ls -tl" go to the default device, the computer screen,
we're sending it to a file called fred with the ">" character. (There is
also a "<" character for reading FROM a file. Then type
"ls -tl test1 >>fred" "ls -tl test2 >>fred" "ls -tl test3 >>fred"
"find . -name \* -print >>fred". The ">>" means APPEND to a file.
Then emacs the file adding your name and date at the top. Then type 
"lpr fred", and it's ready to hand in.





______________________________________________________________________________


                             Berkeley Unix summary

Applies to 4.2bsd, using the C Shell

  All documentation for the system is online.  By using the "apropos" and "man"
  commands, you can usually find anything.  Look at the general command  format
  and conventions of this document near the end.

Control Characters

  You  can  change  the  control  characters  with  "stty",  but  these are the
  defaults:

  Editing

  <rubout>                 delete previous character from screen
  ^W                       delete previous word from screen
  ^U                       delete whole current line from screen

  Job Control

  ^C                       kill the current process
  ^Z                       stop the current process, but leave it around

  End of File

  ^D                       end of file - if you are reading  a  file  from  the
                           terminal,  this  ends  it.    If  you are at command
                           level, it will log  you  out  (but  see  section  on
                           controlling your job

File and Directory Commands

  cat files                conCATenate: copies files to std. output as one file

  cd directory             Change working Directory

  chgrp group files        CHange  GRouP  id  for  files.   Takes group name or
                           number

  chmod mode files         CHange MODe for files.  [This is file protection.]
                               E.g. "chmod go+rx foo" allows Others to Read.
                           first letter from "ugo" [user, group, others]
                           symbol is + to add, - to remove, = to set
                           second letter from "rwxst"  [read,  write,  execute,
                              setuid, sticky]

  cp infile outfile        CoPy file
  cp files directory       CoPy several files into a different directory
     -i                       interactively  confirm  if  will overwrite an old
                              file
     -r                       recursively copy all files in directories

  diff file1 file2         shows DIFFerences between files
     -b                       ignore blank spaces
     -c                       show more of the context

  df                       shows amount of Disk space Free

  du [directory]           shows Disk Usage of directory [default: current dir]

  emacs file               edit file with EMACS.  (Try "teach-emacs"  to  learn
                                       2


                           about EMACS.)

  fpr                      Fortran  PRint  (interp carriage ctl) std in --> std
                           out

  grep pattern files       search all files for a string  (actually  a  general
                           pattern)  Many  options.   fgrep and egrep are minor
                           variants.

  head [files]             show HEAD (first few lines) of  files  [default  std
                           in]

  ln oldfile newname       LiNk files: create an alternate name for a file
  ln -s filespec name      symbolic LiNk: "name" will refer to filespec

  lpq                      show Line Printer Queue

  lpr files                print files on Line PRinter [has many options]

  lprm                     ReMove current job from Line Printer [if yours]
  lprm -                   ReMove all your jobs from Line Printer
  lprm jobnumber           ReMove specified job from Line Printer

  ls [files]               LiSt files [default: all files in directory]
     -a                       all  files  [normally  files  starting with . not
                              shown]
     -l                       long form - give lots of information
     -t                       time-sorted - most recent first
     -R                       Recursively look into directories

  more [files]             print files, stop when screen full [default: std in]

  mv oldfile newname       MoVe or rename file
  mv files directory       MoVe files into a directory
     -i                       interactively confirm if new name exists
     -                        kludge to handle files that begin with "-"

  popd                     POP Directory name from directory name stack

  pushd directory          PUSH current Directory onto dir name stack and  then
                           change working directory to specified one

  pwd                      Print Working Directory name

  quota                    show your disk QUOTA

  rm files                 ReMove files (actually only 1 link to them)
     -i                       interactively confirms each one
     -r                       recursively remove contents of directories
     -                        kludge to handle files that begin with "-"

  rmdir directory          ReMove DIRectory

  tail [file]              show  TAIL  (last few lines) of a file [default: std
                           in]

  touch files              update last write date of files to current date-time
                                       3


Compiling Programs

  cc files                 Compile C files.  Normally loads as a.out
     -c                       don't load, leave relocatables as foo.o
     -gx                      produce info for debugger [always use this]
     -O                       optimize
     -o output                name the output file this

  f77 files                Compile Fortran files.   Normally  loads  as  a.out.
                           Can handle several languages:
                           .f Fortran
                           .F Fortran but through C preprocessor first
                           .r Ratfor
                           .e EFL
                           .c C
                           .s assembly

     -c                       don't load, leave relocatables as foo.o
     -C                       put in code to check array bounds
     -g                       produce info for debugger [always use this]
     -O                       optimize
     -o output                name the output file this

  pascal files             Compile PASCAL files.  Normally loads as a.out
     -c                       don't load, leave relocatables as foo.o
     -g                       produce info for debugger [always use this]
     -O                       optimize
     -o output                name the output file this

Finding Out Information

  alias                    list all defined commands

  apropos word             find all commands and subroutines whose descriptions
                           include this word

  date                     print current DATE and time

  df                       shows amount of Disk space Free

  du [directory]           shows Disk Usage of directory [default: current dir]

  finger                   who is logged in, how long  idle,  office  addr  and
                           phone
  finger user              shows  personal  information  [use chfn to set yours
                           up]

  groups [user]            what GROUPS does user [default: you] belong to?

  history [number]         print most recent number command you did.    If  you
                           want  to  do this, you must put "set history = n" in
                           your .cshrc file, where N is the number of  commands
                           you want remembered

  mail                     send and read mail.  Too complex to describe here

  man [section] name       look  up  command,  routine,  etc.  in  manual.   If
                           section specified, look only in that section.

  printenv                 PRINT your  ENVironment  variables  (terminal  type,
                           etc.)
                                       4


  ps [options]             show processes. default is only yours
     a                        all processes controlled by a terminal
     g                        show group leaders (top level processes)
     tx                       processes on tty x, e.g. ti03 for ttyi03
     u                        user oriented output
     x                        even processes with no terminal

  pwd                      Print Working Directory name

  quota                    show your disk QUOTA

  stty                     show current terminal settings

  time command             print execution TIME, etc., of a command

  uptime                   amt of TIME system has been UP, load avg, etc.

  users                    compact list of all USERS logged on

  vnews                    read system news/announcements

  w                        Who is on system, when logged in, load avg., etc.

  whatis name              gives you title line from thing's manual entry

  whereis name             finds location of system files

  who [name]               who is on the system, when logged in, terminal

Setting Things Up

  .cshrc                   a  file  in  your  home directory.  Is obeyed by the
                           shell whenever one starts.

  .login                   a file in your home directory.   Is  obeyed  by  the
                           shell when you log in (after .cshrc if any).

  .logout                  a  file  in  your  home directory.  Is obeyed by the
                           shell when you logout.

  alias name command       define a new command
  alias name               undefine a command
  alias                    list all defined commands

  clear                    CLEAR terminal screen

  ignoreeof                don't logout when you type ^D.   You  must  use  the
                           logout  command.    We  recommend  putting  this  in
                           .login.

  passwd                   change your PASSWorD.  Asks for old  and  twice  for
                           new

  reset                    RESET terminal [in case EMACS crashes.  Normally you
                           must do "<linefeed>reset<linefeed>", and it may  not
                           echo.

  script file              put SCRIPT of terminal session in a file
     -a                       append to existing file

  setenv variable value    set  a variable in your "environment", e.g term type
                                       5


                           Use "printenv" to see what sorts of things there are

  set term = v55           tell the system you are using a v55 terminal.    You
                           must put spaces around the =.  Required on dialup or
                           network lines.  (The system  knows  about  hardwired
                           lines.)

  stty options             set  up  your  terminal.    Too many options to list
                           here.
  stty                     show current options

  su username              become another user [use ^D to exit]

  tset                     put in .login file to set up terminal depending upon
                           speed,  tty  number,  etc.   Too complex to describe
                           here.

Communicating with Others

  ftp                      File Transfer Program - copy files over network

  postnews                 POST an article in the NEWS system (will prompt  you
                           for the information needed)

  talk person [ttyname]    establish  two-window  TALK  link. other person must
                           also type the command first.  End with ^C.

  telnet host              login on remote host.  ^[q to quit.

  vnews                    read system news/announcements

  write user [ttyname]     WRITEs line from your terminal to his. end with  ^D.
     ! line                   ! at beginning of line causes it to be executed

Controlling Your Jobs

  ^C                       kill current job

  ^D                       unless  you  have  does "ignoreeof", ^D will log you
                           out (or exit from recursive shell)

  ^Z                       stop current job, but leave it around. (use "fg"  or
                           "bg" to continue it, "jobs" to see it)

  clear                    CLEAR terminal screen

  logout                   log off the system

  reset                    RESET terminal [in case EMACS crashes.  Normally you
                           must do "<linefeed>reset<linefeed>", and it may  not
                           echo.

  bg [%job]                continue  a  job  in  background.  [Default: current
                           job]

  csh args                 explicit call to the C Shell.  Too complex for here.

  history [number]         print most recent number command you did.    If  you
                           want  to  do this, you must put "set history = n" in
                           your .cshrc file, where N is the number of  commands
                           you want remembered
                                       6


  kill 123                 KILL process 123 [system-wide numbering, use "ps"]
  kill %1                  KILL job 1 [your process 1, use "jobs"]
     -9                       don't let it trap the interrupt

  fg [%job]                continue  a  job  in  foreground.  [Default: current
                           job]

  stop [%job]              stop a job [default current] running in background

  %job [&]                 continue a job in foreground [in background if &]

Conventions in this Document

  files           a list of file names, separated by spaces,  with  possible  *
                  and ? as wildcards

  %job            % followed by a job number or the name of the program running
                  in the job.  Use the "jobs" command to list your jobs.    The
                  one  with  + by it is the "current job".  NB:  The term "job"
                  is used in the C Shell to refer to a subprocess running under
                  the  control  of  your shell.  This is a bit confusing, since
                  the word "job" normally refers to everything a given user  is
                  doing.   (Indeed the term is used elsewhere in Unix with this
                  meaning.)

  -x              options are listed below the command they apply to.   Several
                  options  can  be combined with a single -.  E.g "ls -lt". The
                  options are always given right after the command name, before
                  any other arguments.

General Command Structure

  command [-options] arguments [<inputfile] [>outputfile] [>&erroroutfile] [&]

      command   is  the  name  of  a  program.    The  "PATH" variable shown by
                "printenv" shows you where it looks  if  you  don't  specify  a
                directory name.  Normally your own directory is in the path, so
                you can run a program you have  compiled  just  by  typing  its
                name.

      options   are normally single letters, with a "-" before them

      arguments are  normally file names, separated by spaces, but can be other
                things

      < > >&    cause standard input, standard output, and error output  to  be
                redirected  to  files.   Not all commands use standard input or
                output.  Typically these represent what  you  would  expect  to
                appear  on  the terminal.  Some commands let you specify a file
                name, and read from that file, but if you  don't  specify  one,
                they read from standard input.

      &         at the end of a command causes it to be done in the background.
                You can type other commands while it is being done.

File and Directory Names

  The syntax for files, directories, and devices is the same:

      a/b/c/d...
                                       7


  where a, b, c, d, are successive levels in the directory hierarchy,  starting
  with the current directory.  So

      prog.c

  is a file in the current directory

      bigsystem/prog.c

  is in a subdirectory contained within the current directory

      bigsystem/source/prog.c

  is in a nested subdirectory, etc.

  Dots  are just another character, but the tendency is to have a single dot in
  a file name, and have what is after the dot indicate what the file  is,  e.g.
  the  language  it is in.  So ".c" is usually a C program, ".p" Pascal, ".o" a
  relocatable object file, etc.

  If you start the name with a /, then you are giving a directory path starting
  at  the top-level directory (called the "root"). For efficiency reasons, user
  directories are not directly in the root, but are subdirectories  of  /u1  or
  /u2.  So one of my files might be

      /u1/hedrick/prog.c

  If  my  current  directory is "/u1/hedrick", then I can refer to that file as
  "prog.c"

  Devices are simply special files, normally put in the directory /dev.    E.g.
  your  terminal  can  be referred to as "/dev/tty". If you want to use someone
  else's terminal, you have to specify the number, e.g.   "/dev/ttyi06".    The
  tape  drive  is  "/dev/mt0". Some programs also want access to "raw devices",
  e.g. the raw tape drive is "/dev/rmt0".  This bypasses  some  levels  of  the
  device  driver,  and  is  supposedly  "more  efficient".    Don't  use a name
  beginning with "/dev/r" unless  the  program  specifically  asks  for  a  raw
  device.    Tape drives are even more complex, as the number encodes (1) which
  tape drive it is, (2) what speed you want,  and  (3)  whether  to  rewind  it
  before use.

  There are some special characters that you can use in file names:

  .         the current directory, e.g.  "cp /u1/hedrick/prog.c ." which copies
            the file to the current directory

  ..        the directory above the current one

  ~hedrick  hedrick's home directory.  Since you don't know  whether  a  user's
            home directory is on /u1 or /u2, it is safest to use this syntax to
            refer to another user's files.

History Substitutions

  These are available if you have turned on the history mechanism,  by  putting
  "set  history  =  n",  where  N  is a number, into your .cshrc file.  You can
  repeat a previous command by using

   !n          command number [use "history" command to see them]
   !-n         n commands ago
   !!          previous command
                                       8


   !xxx        command beginning with xxx
   !s/old/new/ reexecute previous replacing old with new
   ! | more    reexecute, piping output through "more"

  Actually you can do far more general things, but see the C Shell  manual  for
  that.








From pryor@physics.rutgers.edu Thu Jan 16 09:01:19 1997
Return-Path: <pryor@physics.rutgers.edu>
Received: from astro.as.arizona.edu by wharfrat.as.arizona.edu (SMI-8.6/SMI-SVR4)
	id JAA15158; Thu, 16 Jan 1997 09:01:18 -0700
Received: from pryor.rutgers.edu by astro.as.arizona.edu (5.x/SMI-SVR4)
	id AA16134; Thu, 16 Jan 1997 09:01:12 -0700
Received: (from pryor@localhost) by pryor.rutgers.edu (8.6.12+bestmx+oldruq+newsunq+grosshack/8.6.12) id LAA12881 for edo@as.arizona.edu; Thu, 16 Jan 1997 11:01:05 -0500
Date: Thu, 16 Jan 1997 11:01:05 -0500
From: Tad Pryor <pryor@physics.rutgers.edu>
Message-Id: <199701161601.LAA12881@pryor.rutgers.edu>
To: edo@astro.as.arizona.edu
Subject: Unix
Content-Type: X-sun-attachment
Content-Length: 18942
Status: R

----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Content-Lines: 4

The attached file below is a UNIX "reference card" that summarizes lots of
things.  We also have various intro documents floating around on our system,
thought they don't seem very good.

----------
X-Sun-Data-Type: default
X-Sun-Data-Name: unix-refcard.doc
X-Sun-Content-Lines: 453




                             Berkeley Unix summary

Applies to 4.2bsd, using the C Shell

  All documentation for the system is online.  By using the "apropos" and "man"
  commands, you can usually find anything.  Look at the general command  format
  and conventions of this document near the end.

Control Characters

  You  can  change  the  control  characters  with  "stty",  but  these are the
  defaults:

  Editing

  <rubout>                 delete previous character from screen
  ^W                       delete previous word from screen
  ^U                       delete whole current line from screen

  Job Control

  ^C                       kill the current process
  ^Z                       stop the current process, but leave it around

  End of File

  ^D                       end of file - if you are reading  a  file  from  the
                           terminal,  this  ends  it.    If  you are at command
                           level, it will log  you  out  (but  see  section  on
                           controlling your job

File and Directory Commands

  cat files                conCATenate: copies files to std. output as one file

  cd directory             Change working Directory

  chgrp group files        CHange  GRouP  id  for  files.   Takes group name or
                           number

  chmod mode files         CHange MODe for files.  [This is file protection.]
                               E.g. "chmod go+rx foo" allows Others to Read.
                           first letter from "ugo" [user, group, others]
                           symbol is + to add, - to remove, = to set
                           second letter from "rwxst"  [read,  write,  execute,
                              setuid, sticky]

  cp infile outfile        CoPy file
  cp files directory       CoPy several files into a different directory
     -i                       interactively  confirm  if  will overwrite an old
                              file
     -r                       recursively copy all files in directories

  diff file1 file2         shows DIFFerences between files
     -b                       ignore blank spaces
     -c                       show more of the context

  df                       shows amount of Disk space Free

  du [directory]           shows Disk Usage of directory [default: current dir]

  emacs file               edit file with EMACS.  (Try "teach-emacs"  to  learn
                                       2


                           about EMACS.)

  fpr                      Fortran  PRint  (interp carriage ctl) std in --> std
                           out

  grep pattern files       search all files for a string  (actually  a  general
                           pattern)  Many  options.   fgrep and egrep are minor
                           variants.

  head [files]             show HEAD (first few lines) of  files  [default  std
                           in]

  ln oldfile newname       LiNk files: create an alternate name for a file
  ln -s filespec name      symbolic LiNk: "name" will refer to filespec

  lpq                      show Line Printer Queue

  lpr files                print files on Line PRinter [has many options]

  lprm                     ReMove current job from Line Printer [if yours]
  lprm -                   ReMove all your jobs from Line Printer
  lprm jobnumber           ReMove specified job from Line Printer

  ls [files]               LiSt files [default: all files in directory]
     -a                       all  files  [normally  files  starting with . not
                              shown]
     -l                       long form - give lots of information
     -t                       time-sorted - most recent first
     -R                       Recursively look into directories

  more [files]             print files, stop when screen full [default: std in]

  mv oldfile newname       MoVe or rename file
  mv files directory       MoVe files into a directory
     -i                       interactively confirm if new name exists
     -                        kludge to handle files that begin with "-"

  popd                     POP Directory name from directory name stack

  pushd directory          PUSH current Directory onto dir name stack and  then
                           change working directory to specified one

  pwd                      Print Working Directory name

  quota                    show your disk QUOTA

  rm files                 ReMove files (actually only 1 link to them)
     -i                       interactively confirms each one
     -r                       recursively remove contents of directories
     -                        kludge to handle files that begin with "-"

  rmdir directory          ReMove DIRectory

  tail [file]              show  TAIL  (last few lines) of a file [default: std
                           in]

  touch files              update last write date of files to current date-time
                                       3


Compiling Programs

  cc files                 Compile C files.  Normally loads as a.out
     -c                       don't load, leave relocatables as foo.o
     -gx                      produce info for debugger [always use this]
     -O                       optimize
     -o output                name the output file this

  f77 files                Compile Fortran files.   Normally  loads  as  a.out.
                           Can handle several languages:
                           .f Fortran
                           .F Fortran but through C preprocessor first
                           .r Ratfor
                           .e EFL
                           .c C
                           .s assembly

     -c                       don't load, leave relocatables as foo.o
     -C                       put in code to check array bounds
     -g                       produce info for debugger [always use this]
     -O                       optimize
     -o output                name the output file this

  pascal files             Compile PASCAL files.  Normally loads as a.out
     -c                       don't load, leave relocatables as foo.o
     -g                       produce info for debugger [always use this]
     -O                       optimize
     -o output                name the output file this

Finding Out Information

  alias                    list all defined commands

  apropos word             find all commands and subroutines whose descriptions
                           include this word

  date                     print current DATE and time

  df                       shows amount of Disk space Free

  du [directory]           shows Disk Usage of directory [default: current dir]

  finger                   who is logged in, how long  idle,  office  addr  and
                           phone
  finger user              shows  personal  information  [use chfn to set yours
                           up]

  groups [user]            what GROUPS does user [default: you] belong to?

  history [number]         print most recent number command you did.    If  you
                           want  to  do this, you must put "set history = n" in
                           your .cshrc file, where N is the number of  commands
                           you want remembered

  mail                     send and read mail.  Too complex to describe here

  man [section] name       look  up  command,  routine,  etc.  in  manual.   If
                           section specified, look only in that section.

  printenv                 PRINT your  ENVironment  variables  (terminal  type,
                           etc.)
                                       4


  ps [options]             show processes. default is only yours
     a                        all processes controlled by a terminal
     g                        show group leaders (top level processes)
     tx                       processes on tty x, e.g. ti03 for ttyi03
     u                        user oriented output
     x                        even processes with no terminal

  pwd                      Print Working Directory name

  quota                    show your disk QUOTA

  stty                     show current terminal settings

  time command             print execution TIME, etc., of a command

  uptime                   amt of TIME system has been UP, load avg, etc.

  users                    compact list of all USERS logged on

  vnews                    read system news/announcements

  w                        Who is on system, when logged in, load avg., etc.

  whatis name              gives you title line from thing's manual entry

  whereis name             finds location of system files

  who [name]               who is on the system, when logged in, terminal

Setting Things Up

  .cshrc                   a  file  in  your  home directory.  Is obeyed by the
                           shell whenever one starts.

  .login                   a file in your home directory.   Is  obeyed  by  the
                           shell when you log in (after .cshrc if any).

  .logout                  a  file  in  your  home directory.  Is obeyed by the
                           shell when you logout.

  alias name command       define a new command
  alias name               undefine a command
  alias                    list all defined commands

  clear                    CLEAR terminal screen

  ignoreeof                don't logout when you type ^D.   You  must  use  the
                           logout  command.    We  recommend  putting  this  in
                           .login.

  passwd                   change your PASSWorD.  Asks for old  and  twice  for
                           new

  reset                    RESET terminal [in case EMACS crashes.  Normally you
                           must do "<linefeed>reset<linefeed>", and it may  not
                           echo.

  script file              put SCRIPT of terminal session in a file
     -a                       append to existing file

  setenv variable value    set  a variable in your "environment", e.g term type
                                       5


                           Use "printenv" to see what sorts of things there are

  set term = v55           tell the system you are using a v55 terminal.    You
                           must put spaces around the =.  Required on dialup or
                           network lines.  (The system  knows  about  hardwired
                           lines.)

  stty options             set  up  your  terminal.    Too many options to list
                           here.
  stty                     show current options

  su username              become another user [use ^D to exit]

  tset                     put in .login file to set up terminal depending upon
                           speed,  tty  number,  etc.   Too complex to describe
                           here.

Communicating with Others

  ftp                      File Transfer Program - copy files over network

  postnews                 POST an article in the NEWS system (will prompt  you
                           for the information needed)

  talk person [ttyname]    establish  two-window  TALK  link. other person must
                           also type the command first.  End with ^C.

  telnet host              login on remote host.  ^[q to quit.

  vnews                    read system news/announcements

  write user [ttyname]     WRITEs line from your terminal to his. end with  ^D.
     ! line                   ! at beginning of line causes it to be executed

Controlling Your Jobs

  ^C                       kill current job

  ^D                       unless  you  have  does "ignoreeof", ^D will log you
                           out (or exit from recursive shell)

  ^Z                       stop current job, but leave it around. (use "fg"  or
                           "bg" to continue it, "jobs" to see it)

  clear                    CLEAR terminal screen

  logout                   log off the system

  reset                    RESET terminal [in case EMACS crashes.  Normally you
                           must do "<linefeed>reset<linefeed>", and it may  not
                           echo.

  bg [%job]                continue  a  job  in  background.  [Default: current
                           job]

  csh args                 explicit call to the C Shell.  Too complex for here.

  history [number]         print most recent number command you did.    If  you
                           want  to  do this, you must put "set history = n" in
                           your .cshrc file, where N is the number of  commands
                           you want remembered
                                       6


  kill 123                 KILL process 123 [system-wide numbering, use "ps"]
  kill %1                  KILL job 1 [your process 1, use "jobs"]
     -9                       don't let it trap the interrupt

  fg [%job]                continue  a  job  in  foreground.  [Default: current
                           job]

  stop [%job]              stop a job [default current] running in background

  %job [&]                 continue a job in foreground [in background if &]

Conventions in this Document

  files           a list of file names, separated by spaces,  with  possible  *
                  and ? as wildcards

  %job            % followed by a job number or the name of the program running
                  in the job.  Use the "jobs" command to list your jobs.    The
                  one  with  + by it is the "current job".  NB:  The term "job"
                  is used in the C Shell to refer to a subprocess running under
                  the  control  of  your shell.  This is a bit confusing, since
                  the word "job" normally refers to everything a given user  is
                  doing.   (Indeed the term is used elsewhere in Unix with this
                  meaning.)

  -x              options are listed below the command they apply to.   Several
                  options  can  be combined with a single -.  E.g "ls -lt". The
                  options are always given right after the command name, before
                  any other arguments.

General Command Structure

  command [-options] arguments [<inputfile] [>outputfile] [>&erroroutfile] [&]

      command   is  the  name  of  a  program.    The  "PATH" variable shown by
                "printenv" shows you where it looks  if  you  don't  specify  a
                directory name.  Normally your own directory is in the path, so
                you can run a program you have  compiled  just  by  typing  its
                name.

      options   are normally single letters, with a "-" before them

      arguments are  normally file names, separated by spaces, but can be other
                things

      < > >&    cause standard input, standard output, and error output  to  be
                redirected  to  files.   Not all commands use standard input or
                output.  Typically these represent what  you  would  expect  to
                appear  on  the terminal.  Some commands let you specify a file
                name, and read from that file, but if you  don't  specify  one,
                they read from standard input.

      &         at the end of a command causes it to be done in the background.
                You can type other commands while it is being done.

File and Directory Names

  The syntax for files, directories, and devices is the same:

      a/b/c/d...
                                       7


  where a, b, c, d, are successive levels in the directory hierarchy,  starting
  with the current directory.  So

      prog.c

  is a file in the current directory

      bigsystem/prog.c

  is in a subdirectory contained within the current directory

      bigsystem/source/prog.c

  is in a nested subdirectory, etc.

  Dots  are just another character, but the tendency is to have a single dot in
  a file name, and have what is after the dot indicate what the file  is,  e.g.
  the  language  it is in.  So ".c" is usually a C program, ".p" Pascal, ".o" a
  relocatable object file, etc.

  If you start the name with a /, then you are giving a directory path starting
  at  the top-level directory (called the "root"). For efficiency reasons, user
  directories are not directly in the root, but are subdirectories  of  /u1  or
  /u2.  So one of my files might be

      /u1/hedrick/prog.c

  If  my  current  directory is "/u1/hedrick", then I can refer to that file as
  "prog.c"

  Devices are simply special files, normally put in the directory /dev.    E.g.
  your  terminal  can  be referred to as "/dev/tty". If you want to use someone
  else's terminal, you have to specify the number, e.g.   "/dev/ttyi06".    The
  tape  drive  is  "/dev/mt0". Some programs also want access to "raw devices",
  e.g. the raw tape drive is "/dev/rmt0".  This bypasses  some  levels  of  the
  device  driver,  and  is  supposedly  "more  efficient".    Don't  use a name
  beginning with "/dev/r" unless  the  program  specifically  asks  for  a  raw
  device.    Tape drives are even more complex, as the number encodes (1) which
  tape drive it is, (2) what speed you want,  and  (3)  whether  to  rewind  it
  before use.

  There are some special characters that you can use in file names:

  .         the current directory, e.g.  "cp /u1/hedrick/prog.c ." which copies
            the file to the current directory

  ..        the directory above the current one

  ~hedrick  hedrick's home directory.  Since you don't know  whether  a  user's
            home directory is on /u1 or /u2, it is safest to use this syntax to
            refer to another user's files.

History Substitutions

  These are available if you have turned on the history mechanism,  by  putting
  "set  history  =  n",  where  N  is a number, into your .cshrc file.  You can
  repeat a previous command by using

   !n          command number [use "history" command to see them]
   !-n         n commands ago
   !!          previous command
                                       8


   !xxx        command beginning with xxx
   !s/old/new/ reexecute previous replacing old with new
   ! | more    reexecute, piping output through "more"

  Actually you can do far more general things, but see the C Shell  manual  for
  that.


