Skip to content | Change text size

eSolutions home

Quick links


 

Introduction to Unix

There are many versions (or flavours) of UNIX, though the two most common are System V developed by AT & T, and Berkeley Software wt Distribution (BSD) developed by the University of California in Berkeley. Virtually all vendor implementations of UNIX are based upon these two versions.

UNIX at ITS

The Computer Centre operates a number of UNIX systems for staff and student use. These UNIX systems range from stand alone workstations such as DECstations to systems such as IBM RS6000 and Pyramid systems. Some of the UNIX machines at the Computer Centre are listed in Table 1.

VendorSystemOperating
System
Based on
DigitalDECstationUltrixBSD 4.2/4.3
Pyramid98xe / MIS-2OsXAT & T System V & BSD 4.2
Silicon GraphicsPersonal IrisIrixAT & T System V
IBMRS6000AIXAT & T System V

Table 1 UNIX machines at the Computer Centre

Although there are two major versions of UNIX and many vendor specific implementations, all of these versions have much in common.

Users who would like to learn more about UNIX should purchase a book from the University bookshop on their campus, or borrow one from their campus library.

Any good UNIX book should at least cover both the AT & T and BSD UNIX environments.

Getting Started

In order to use UNIX, you must be registered with the Computer Centre. Please refer to section 2.1 on Registration Process for more information on how to get an account with the Computer Centre.

Logging In and Out

Note: It is important to remember that UNIX is case sensitive unlike other operating systems e.g. DOS.

The process of logging into a UNIX machine and then logging out is described in section 2.3.

Users are also advised to read the section 2.2 on Passwords before proceeding further.

UNIX Operating System

UNIX is a multi-user system which allows the user to share a machine with other users and to run several processes or programs at the same time.

UNIX was first developed in the early 1970's by Ken Thompson and others at Bell Laboratories in the USA. It was devised as an alternative to the clumsy and awkward operating systems in use at that time.

UNIX was made licensed to Universities where it gained immediate popularity. The release of UNIX version 7 in 1978 and System III in 1982 heralded the beginning of the widespread use of UNIX in non academic applications.

Several factors make UNIX popular.

First, UNIX is written in a high level language 'C' which makes UNIX portable allowing it to run on different computers.

Second, UNIX source code is available for special requirements which can then be adapted to particular requirements.

Finally, UNIX is a good operating system as it is flexible and well structured.

UNIX File System

The UNIX file system is a hierarchical tree structured file system.

The topmost directory is called the root directory and is denoted by /(forward slash).

All other files reside under the root directory.

A typical directory structure on a UNIX system might look like as shown in Fig 1.

                                /
                                |
          -------------------------------------------------
          |             |                |                |
         usr           bin              etc              edp
          |             |                |                |
       -------          |                |             -------
       |     |          |                |             |     |
      src <files>    <files>          <files>         bp1   staff
          |                                            |     |
       <files>                                      <files> <files>

Fig 1 UNIX Directory Structure

In the above table there are 4 directories under the root directory /.

These are usr, bin, etc and edp.

Some of these directories contain files as well as other directories. When a directory is contained within another directory it is referred to as a sub-directory.

For example, usr is a directory, but it is also a sub-directory of /, just as src is a sub-directory of usr.

Pathnames

Pathnames can be thought of as addresses for files, that is, they describe where files reside within the file system. Pathnames consist of directory names and filenames, with each being separated by the / symbol i.e.

                /dir/subdirectory/subdirectory/...../filename

A leading / in the pathname indicates that the pathname is starting from the root level directory, not the current directory.

For example, assuming that your current directory is /usr/student/fred, then the following two pathnames do not refer to the same files.

 (i)     /usr/local/lib/qterm.tab

 (ii)    usr/local/lib/qterm.tab

Why? The first pathname is starting from the root level, so it is referring to the file qterm.tab in the directory /usr/local/lib.

The second pathname is starting from the current directory, in this case /usr/student/fred, therefore the second pathname is referring to a file called qterm.tab in the directory /usr/student/fred/usr/local/lib.

Filename Specifications

Filenames under UNIX can be up to 64 characters in length in AT & T UNIX and up to 255 characters in BSD UNIX.

They can be composed of any characters except for the / character. This may also include non printable characters. Filenames are case sensitive.

It is a safe practice to ensure that your filenames contain only the following characters:

  • uppercase and lowercase letters
  • digits
  • underscore (_)
  • period (.)
  • dash (-)

Other characters may be misinterpreted.

UNIX distinguishes between upper and lowercase characters in filenames. The filenames FRED.DAT and fred.dat under UNIX would refer to two separate files.

Unlike MS-DOS, UNIX does not use extensions i.e. primary file name separated by a period from a secondary file name e.g. Fred.dat.

Therefore you are allowed to use as many periods in your filenames as you like. However remember application programs look sometimes for the last characters (secondary names) of a filename separated by a period to determine what kind of file it is e.g.

  • ps postscript file
  • c C source code
  • bas BASIC source code

Some Useful UNIX Commands

UNIX commands have the following basic structure:

        command [ - option(s)][argument(s)]

 where    [  ]           denotes "not necessarily required"
         option          option may be preceded by a dash (-)
         argument        arguments separated by spaces

The default prompt on UNIX machine differs from system to system. It is usually either $ or %

Getting Help on UNIX

UNIX system offers many good on-line help tools. These are :

  • man
  • apropos
  • whatis

The man command is the most useful of the above. It is an excellent source for learning about UNIX commands and all users are strongly recommended to use it extensively.

man

 Syntax:         man  topic
 Description:    Displays manual pages of the selected topic onto the
                 terminal screen.
 Example:        $ man ls
                 displays information on the ls command.
                 $ man man
                 displays information on the man command itself !

apropos

 Syntax:         apropos expression
 Description:    Apropos shows which manual sections contain
                 occurrences of any of the given keyword in their
                 title. The apropos utility  can be helpful if you can
                 remember what a command does but you have forgotten
                 its name!
                 Each word is treated separately and is not
                 case sensitive.

Note: This command is available in BSD versions of UNIX. The equivalent command in AT & T UNIX is man -k.

 Example $ apropos editor
         displays all the utilities that contain the word editor in
         their description.

whatis

 Syntax:         whatis command
 Description:    This gives a short description of the command.
                 You can then look up man for more details.
                 NOTE: This is available only on BSD UNIX.
 Example:        $ whatis ed
                 displays a short description of ed.

Correcting Mistakes

The following commands are handy to remember when typing commands in UNIX at the prompt:

Erase key

One of the following will act as a key to erase the characters (one at a time) you have just entered:

  • Pressing [CTRL] and [H] together.
  • Pressing the BACKSPACE KEY [SYMBOL 220 \f "Symbol" ]
  • Pressing the DELETE KEY [DELETE]
  • Typing # in your command means "Delete the character before #" or the character chosen by you and installed with the stty command.

Line Kill Key

One of the following will delete the entire line and go to the prompt on a new line.

  • Pressing [CTRL] and [U] together.
  • Pressing the RETURN KEY
  • Typing @ in your command will take you to the prompt on a new line
  • or the character chosen by you and installed with the stty command.

UNIX Commands

cat

 Syntax:         cat [-options] [file1, file2, ...]
                 cat file1 file2 > file3
 Description:    Displays the contents of the specified file(s) to
                 standard output, typically the terminal screen.
                 If no filename is specified then cat will read
                 from standard input until a EOF character (^D)
                 is encountered.

Some useful options:

 -n              Causes line numbers to be displayed.
 -v              Causes non printable characters to be made visible.
 -t              Displays tab characters as ^I
 -e              Causes a $ symbol to be displayed at the end of
                 each line, prior to the newline character.

cd

 Syntax:         cd [directory]
 Description:    Change directory to the specified directory.
                 If no directory was specified then the value from the
                 variable HOME is used instead {see section 4.6.3}.

cp

 Syntax:         cp [-i] file1 file2
                 cp [-i] file,... directory
 Description:    Copies the contents of file1 to file2, or copies the
                 specified files to the specified directory.

The -i option causes the user to be prompted with the name of the file, whenever the copy will overwrite an already existing file. An answer of 'y' will cause cp to continue, any other answer will prevent it from overwriting the file.

ls

 Syntax:         ls  -[options] [dirname | filename]
 Description:    Display the current directory contents.
                 If a filename is specified then all files matching
                 that filename specification will be displayed.

Some of the more commonly used options are:

 -a      Display all files.
 -x      Display the directory contents across the screen.
 -l      Display the directory contents in long format.
 -r      Display the directory contents in reverse order.
 -R      Recursively list files  in subdirectories.
 -t      Display files sorted by time stamp.

mkdir

 Syntax:         mkdir dirname ...
 Description:    Creates the specified directories.

mv

 Syntax:         mv  file1  file2
                 mv  file1  [file2 ...] directory
 Description:    In the first form, mv will move one file to another
                 file.  In this case it is very much like the DOS
                 rename command, except that if file2  exists, then
                 it will be overwritten.
                 In its second form, mv will move the file(s) specified
                 into the specified directory.
                 The files are actually moved not copied.

                 NOTE: mv will not move files across file systems
                       that span physical disks.

more

 Syntax:         more filename,...
 Description:    Displays the contents of the specified files one page
                 at a time.  More has extensive options available.
                 An online help screen can be activated by
                 typing ? within More. 

pg

 Syntax:         pg  filename,...
 Description:    Display the contents of the specified files a page
                 at a time. Pg supports many options.
                 A help screen detailing these options can be activated
                 by pressing ? whilst in pg.

                 NOTE: This is a System V command.

pwd

 Syntax:         pwd
 Description:    Displays the name of the current working directory.

rm

Syntax:         rm -[options] filename...
 Description:    Deletes the specified file(s) from a directory.
                 If a directory is specified then a error is displayed
                 unless the -r option is specified. 
Some options are:
 -f              Causes the removal of the specified files without
                 prompting the user or reporting any errors that occur
 -r              Recursively deletes the contents of the specified
                 directory, and then the directory itself.
 -i              Causes the user to confirm each of the file deletions,
                 interactively.

rmdir

 Syntax:         rmdir dirname
 Description:    Deletes the specified directory.
                 The directory MUST be empty for the command to work.

File Access Permission

Typing the command ls -l centre.dat at the UNIX prompt in my home directory gives me the following output:

        -rwx------  1   deepak  2098    Dec 17  16.20   centre.dat

The first dash indicates that I have a simple file. If it was a directory it would have been a "d".

The next 9 characters represent the access permissions on the file. Next is a number (in this case 1) which tells you the number of links i.e. alternative filenames for this file.

Then there is the owner followed by the size in bytes and the date-time of the last modification.

Finally there is the filename.

The 9 characters of the access permissions can be divided into 3 sets of 3 characters.

The sets are: first 3 characters are for the file owner, next 3 are for the group access and the last three are for other users.

The owner of the file can decide who has what kind of access to the file ( "r" stands for "read", "w" stands for "write" and "x" stands for "execute").

In the above example the owner has all the rights i.e. read, write, access but the group and others have none.

Access permissions can be changed with the command chmod.

chmod

 Syntax:         chmod category=access,... filename,...
 Description:    Changes the access rights on a file.

 Access Rights:          r:Read, x:Execute and w:Write
 Categories:             u:Owner, g:Group and o:Other

Example:

                 $ chmod u=rwx,g=r,o=myfile
                 (Owner has all access, group members
                 have read access while everyone else has no access.)

Printing from UNIX

The following commands are used to print a file, check the printer queue, check the status of printer and to kill the print job.

It is advised that before printing you make sure that you know the name of the printer to which you want the job spooled.

lp

 Syntax:         lp  -[options] [filename]
 Description:    Will submit the specified file to the specified
                 printer queue.
                 NOTE: This is a System V command.

 Commonly used options are:

 -ddest          Specifies the destination printer queue.
 -m              Send you notification by mail when the file(s) have
                 been printed.
 -nn             Specifies the number of copies ( n ) to be printed.
 -w              Display a notification message on the terminal when
                 the file(s) have been printed.

A list of valid printer queues can be found in the file /etc/printcap.

lpstat

 Syntax:         lpstat -[options]
 Description:    Display the status of the printer system.
                 NOTE: This is a System V command.

Some valid options are:

 -pprinter       specify a particular queue.
 -t              display all status information.
 -d              display the system default printer queue.

lpr

 Syntax:m        lpr [ -options ] <filename ...>
 Description:    Will submit the specified file(s) to the specified
                 printer queue.

                 NOTE: This is a BSD command.

 Commonly used options:

 -Pprinter       Force output to a specific printer.
                 Normally, the default printer is used
                 (site dependent), or the value of the environment
                 variable PRINTER is used.
 -t              The file to be printed is assumed to have been
                 generated by troff.
 -r              Delete the file upon completion of spooling
                 or printing.
 -#n             Causes n number of copies to be printed

                 A list of valid print queue name can be found in the
                 file /etc/printcap.

lprm

 Syntax:         lprm [-Pprinter] [-] [job # ...]
 Description:    Removes print job(s) from a printer queue.
                 Invoked without any arguments will delete the
                 currently active job if it is owned by the user.

                 NOTE: This is a BSD command.

If the - option is used, lprm will remove all jobs from the queue the user owns.

Specific print jobs may be deleted by specifying its job number. The job number can be obtained from the lpq command.

lpq

 Syntax:         lpq  [ -options ]
 Description:    lpq examines the spooling area used for printing
                 files on the line printer, and reports the status of
                 the specified jobs or all jobs associated with a user.
                 If invoked without any arguments, lpq reports on any
                 jobs currently in the queue.

                 NOTE: This is a BSD command.

The -P option may be used to specify a particular printer queue, otherwise the default line printer queue is used.

The -l option causes information about each of the files comprising the job to be printed.

UNIX Shells

The shell is both a command language and a programming language that provides the user interface to UNIX (Banahan & Rutter 1988).

UNIX offers many command line interfaces or shells for the user to select from. Each shell has some advantages over the other and it is very much a personal preference as to which one you use.

Also, users who don't like the available shells can write their own!

The shell executes a program when you give it a command. The Shells are sh (Bourne Shell), ksh (Korn Shell) and csh ( C Shell).

The table below show the default shells of the Computer Centre UNIX systems in use at the University.

                System                     Default Shell
        Monu6             (Pyramid)            sh
        Monu1             (Pyramid)            csh
        Nellads, CCDS...  DECstations)         csh
        Cgl01 - Cgl13     Silicon Graphics)    csh
        Morrow & Modus    (IBM RS6000)         ksh

Table 2 Default Shells of the Centre's UNIX machines

Each of the above shells have their own specific advantages, and it will be up to the individual to select their own preference.

Information on the above shells can be obtained by typing <topic>, where <topic> is the name of the shell. For the average user the default shell for the system they are registered on will be more than sufficient for their needs.

Special characters

The Shell interprets a number of characters as special characters as shown in Table 3.

 Character                    Function
 *         Match any string of zero or more characters.
           Called a Metacharacter.
           e.g.  $ls -l a* will list all files starting with
           the letter a.

 ?         Match any single character. Called a Metacharacter
           e.g.  $ls -l ? at will match files with names like cat,
           rat, fat, mat, bat....

 [ ]       Matches any single character listed inside the square
           brackets. Called a Metacharacter.
           e.g. $cat recipe[1234] will display files recipe1, recipe2,
           recipe3, recipe4.

 ;         Command terminator.
           e.g.  $date; ls -l will first execute the command date and
           then the command ls -l.

 &         Typing after the command makes it run in the background.
           e.g.  $ ls -l | lp & will run the command ls -l and send it
           to the printer  all done in the background leaving the you
           to do other work.

 '...'     All special characters lose their special meaning when
           enclosed in single quotes.
           e.g.  $ls '*at' will only match a filename called *at and
           not the files named fat, cat, rat etc.

 \         Disables any special meaning of the character after the \.
           e.g.  $ls \*at will only match a filename called *at and not
           the files named fat, cat, rat etc.

 "..."     All special characters except $, \ , and '...' lose their
           special meaning when enclosed in double quotes.
           e.g. grep "$pname" phone.txt.
           This command is a part of a shell script where pname is a
           user defined variable.

Table 3 Special Characters

Redirection and Filters

Redirection means to assign a different file to a standard input (e.g. the keyboard), standard output (e.g. the screen) or standard error. Filters e.g. pipes allow you to take a command's standard output as standard input for another command.

The characters reserved for these purposes are:

 Character                      Function

 >          Redirects the output of a command to a device or file.
            If a file is specified and it already exists then it
            will be overwritten.
            e.g.. $ man vi > editors.txt will direct the output of
            the man command to the file editor.txt deleting any
            previous contents of the file or creating the file if new.

 >>         Appends the output of a command to a specified device or
            file.  If the specified file does not exist then it
            is created.
            e.g. $ man ex >> editors.txt will append the output of the
            man command to the contents of the file editors.txt or
            create a new file.

 <          Redirects the standard input for the specified command
            from the keyboard to the specified device or file.
            e.g.. $ cat < editors.txt will display the file.

 |          Redirects the output of a command so that it can be used
            as the input for another command.
            e.g.. $ cat editors.txt | more will display the file a
            screenful at a time.

Table 4 Redirection and Filters

Environment Variables

The UNIX shells use startup files to customise a user's environment. Frequently, it tells the system what kind of terminal you are using and executes the set terminal utility to establish your line kill and erase keys (Sobell 1989). The different shells use the following startup files:

            Shell                    Startup files

            ksh                     .profile, .kshrc
            csh                     .login, .cshrc
            sh                      .profile, .login

Table 5 Startup Files

The startup files on execution set up a number of Environment variables. The variables can be listed using any of the following:

  • set : will list all the set variables
  • env : will list all the set variables
  • echo $VARIABLE : will list the specific variable given.

NOTE: The variable name has to be uppercase.

Some of the environment variables are as shown in Table 6:

 Variable Name                      Purpose

 TERM               the terminal type you use e.g. xterm or vt100
 DISPLAY            the display
 PRINTER            the default printer
 PATH               the list of directories where the shell searches
                    for the commands
 PS1                the string used for the prompt in sh and ksh
 prompt             the string used for the prompt in csh
 HOME               the home directory you log in

Table 6 Environment Variables

To change environment variables, use

  • in csh : setenv VARIABLE value
  • in sh and ksh: VARIABLE=value; export VARIABLE

Processes

Each process under UNIX whether it be a interactive login session, a batch job, a spawned subprocess, or whatever, has a unique Process IDentification number, known in UNIX jargon as a PID number.

It is with this pid number that we can perform certain actions on these processes. Once such action is to terminate them.

Why would we want to terminate a process?

Well sometimes you may find yourself with more than one active terminal session. This may have come about by your program hanging, and you couldn't break out, or your terminal just seemed to freeze for no apparent reason.

Your only solution was to login again. So you did, and to your surprise your old session is still there and active. So how do you stop it? You terminate it! How? Just follow the four steps outlined below.

 1.      Firstly we need to find out the PID number(s) of the current
         process running under your login name.
         This is done by typing in the  UNIX  ps  command.
         Like all other UNIX commands ps also has many useful options.
         One of them is the -u (user) option which gives all your
         processes.

         This is done as follows:
  • On System V : $ ps -u loginname (Here loginname is your login name)
  • On BSD : $ ps -u
         This will display a list of all the process running under
         your login name. The actual output of the ps command
         differs between the AT & T and BSD version of UNIX.

 2.      To terminate the unwanted process you type in the
         following command.

         $ kill -9  pid-number

         where pid-number is the pid number of the process to
         be terminated.

You cannot terminate other processes that do not belong to you, so if you make a mistake in typing in the pid number, then you will get an error message.

Example:

  *********************************************************************
  * $ ps -u deepak                                                    *
  *   PID  TTY   TIME COMMAND                                         *
  *   16992  pa    0:00 sh                                            *
  *   17065  pa    0:00 sc.2                                          *
  *   17068  pa    0:00 ps                                            *
  *   17999  pa    2:12 man sh                                        *
  * $                                                                 *
  * $ kill -9 17999                                                   *
  *********************************************************************

Figure 2 Looking up and terminating processes in System V

  *********************************************************************
  * $ ps -u                                                           *
  *   PID TTY  STAT  TIME COMMAND                                     *
  *   16992 pa   S     0:00 sh -i /tmp/sc-input.16992                 *
  *   17065 pa   S     0:00 sc                                        *
  *   19579 pa   S     0:00 sh -i /tmp/sc-input.19579                 *
  *   19580 pa   S     0:00 /usr/local/monash/bin/sc                  *
  *   19582 pa   R     0:00 ps                                        *
  *   19666 pa   S     2:20 ftp wiggins.d&c.monash.edu.au             *
  * $ kill -9 19666                                                   *
  *********************************************************************

Figure 3 Looking up and terminating processes in BSD

Some More UNIX Commands

Nearly all of the UNIX commands support a wide number of command options. For a FULL description of the commands including all of their associated options please use the man <topic> command. Users on X window based systems can use the xman command.

Nearly all of the command listed below are common to both the AT & T System V and BSD 4.2 UNIX environments. Commands specific to one particular version are indicated.

Also, it is important to realise that even though most commands are common between the two environments, the actual behaviour of these commands, and their associated options do in fact vary.

We strongly recommend that you use the man command to check the command and any of its options you intend to use beforehand, especially on commands of a destructive nature.

chgrp

 Syntax:         chgrp group filename,...
 Description:    Changes the group id of the specified file(s).
                 You must belong to the specified group and also be
                 the owner of the file(s) being altered.

chown

 Syntax:         chown username filename,...
 Description:    Change the ownership of the specified files.

cmp

 Syntax:         cmp [-options] file1 file2
 Description:    Compares the contents of two files.

Options are:

 -l              Print the byte number (decimal) and the differing bytes
                 (octal) for each difference encountered.
 -s              Print nothing for differing files, just return a
                 return code.

 Return codes are

 0               Identical files
 1               different files
 2               Inaccessible or missing arguments

date

 Syntax:         date [+ format]
 Description:    Displays the current date and time.

                 Some of the format options are:

 a     Abbreviated weekday             A     Full weekday name
 b     Abbreviated month name          B     Full month name
 d     Day of month (01-31)            D     Date as mm/dd/yy
 e     Day of month with no preceding spaces (1-31)
 H     Hour (00-23)                    I     Hour (01 - 12)
 j     Day of the year (1 - 365)       m     Month of the year (1-12)
 M     Minute (00 - 59)                R     Time as hh:mm:ss

echo

 Syntax:         echo text
 Description:    Displays the specified text to the screen.

 Valid options:

  \b  Print a backspace character    \c   Print the line without a
                                          newline character
  \f  Display a formfeed character   \n   Display a newline character
  \r  Display a carriage return      \t   Display a tab
  \v  Display a vertical tab         \\   Display a backslash character

exit

 Syntax:         exit
 Description:    This will normally terminate the current shell
                 session. If the current shell session is the only
                 shell session you have running then you are logged
                 off the system.

kill

 Syntax:         kill -[signal] pid number
 Description:    Sends a terminate signal to the process specified by
                 pid number.
                 There are 15 types of signal that can be specified.
                 Specifying a signal level of 9 is known as a sure
                 kill, that is, it will terminate the process
                 specified, because a signal level 9 cannot be trapped
                 by the program.

                 NOTE: You cannot kill another user's process.

learn

 Syntax:         learn [subject]
 Description:    Learn invokes the online tutorial system.

 The current list of subjects offered are:

 Subject         Description                           Prerequisites
 Files           Basic file handling commands
 Editor          text editor.                          Files
 vi              screen-oriented text editor           Files
 Morefiles       more on file manipulations
                 and other useful stuff                none
 Macros          "-ms" macros for BTL memos & papers   editor
 Eqn             typing mathematics                    editor
 C               writing programs in the C language    editor

Table 7 List of Subjects

Depending upon which UNIX system you are using, the range of subjects offered may vary. By invoking learn without any arguments, a list of available subjects will be displayed.

Note: The learn facility is not available on the Silicon Graphics workstations.

less

 Syntax:         less  filename,...
 Description:    Another file viewer which is available under both
                 AT & T and BSD UNIX.
                 Like pg and more, less has many built in options.
                 A help screen can be activated by pressing ?
                 whilst you are in less.

logout (csh shell only)

 Syntax:         logout
 Description:    Terminates the current shell session.
                 If the current shell session is the only session then
                 you are logged of the system.

mailx

 Syntax:         mailx [options]
 Description:    Allows users to send mail to other users.
                 The users may be either located on the same systems or
                 on another system attached to a network.
                 NOTE: This is a System V command.

                 Online help is available by typing ? within mailx.

Some useful options:

 -e              Test for presence of mail.
                 Mailx prints nothing and exits with a successful
                 return code if any mail exists.
 -f filename     Read messages from the specified filename instead of
                 the mailbox. If no filename is specified then
                 the file mbox is used.

Mail

 Syntax:         Mail [-options]
 Description:    The BSD equivalent of the AT & T System V mailx command.
                 Allows users to send mail to other users.
                 The users may be located either on the same system
                 or another system attached to a network.
                 This is a BSD command.

Online help for mail is available by typing ? within mail.

Some useful options:

 -v              Invokes mail in verbose mode.
 -i              Causes interrupt signals to be ignored.
                 Useful when using mail from noisy modem lines

passwd

 Syntax:         passwd
 Description:    Allows the user to change their password.
                 When changing your password the following rules apply.

ps

 Syntax:         ps -[options]
 Description:    Displays various information about processes.
                 By default only information about your child processes
                 are displayed.
                 Refer to the man page for a complete list of all
                 options available.
                 Note that the options for the AT & T and BSD versions of
                 ps are not identical.

Some useful options:

 AT & T      BSD       Brief Description
 -e        -g        Display information  for all processes
           -w        Use wide output format (132 col)
 -t term   -t term   Display info for processes controlled by the
                     terminal specified by term
 -l        -l        Display process information in long format.
 -u name   -u        Displays information about the user specified
                     by name

Table 8 Commonly Used Options in ps

who

 Syntax:         who -[options]
                 who  [am i]
 Description:    Without any arguments, who displays the login name,
                 terminal name and login time for each current user.

 By specifying the 'am i' options, as in "who am i", who will tell
 you who you are currently logged in as.

 Some valid AT & T options:
 -u              List users currently logged in.
 -H              Display column heading
 -q              Quick display, displays the names only, and the number
                 of users logged on.

Editors

ed

 Syntax:         ed [filename]
 Description:    ed is the standard UNIX text editor.
                 Ed uses a copy of the file it is editing, so any
                 changes made have no real effect until the file is
                 written out.
                 The copy of the text file being edited is called
                 buffer, and there is only one buffer.

edit

 Syntax:         edit [-r] filename,...
 Description:    Edit is a variant of the text editor ex.
                 It is recommended for new or casual users who wish to
                 use a command-oriented editor.

ex

 Syntax:         ex [filename]
 Description:    ex is a superset of Ed, the most notable extension
                 being a display editing facility.

vi

 Syntax: vi      -[options] [filename,...]
                 view -[options] [filename,...]
                 vedit -[options] [filename,...]
 Description:    vi (VIsual) is a screen orientated text editor based
                 on an underlying line editor ex.

Invoking vi via the view command starts vi in read only mode.

Invoking vi via the vedit command starts vi in beginners mode.

In this mode the showmode and novice flags are set.

To assist new users to vi there is a online tutorial available. This can be accessed by typing learn vi or ucb learn vi for monu6 users.

For more details on some of the editors, see section 7.1.

Accessing CDROM Ultrix Documentation

Users who have access to X-window compatible terminals (DECstations, PCs running X) can access the online CDROM ULTRIX documentation using the DXBOOK utility.

Once you have logged on from a X-window compatible terminal just type dxbook, and in a few seconds a small window will appear displaying a list of books you can access. You can now use the mouse to select the various topics available.

Not only do you have access to all of the Ultrix documentation but you will also be able to access the VMS set of documentation as well.

Introduction to X-Windows

The X Window System is a graphical interface system to the UNIX operating system, designed to control the displays of workstations, such as the DECstations in the Student Computer Labs.

Computer Centre Policies

The Computer Centre Regulations extend to include the X Windows workstations, as well as the following working policies:

  • No locking, hence reservation, of workstations. The demand for workstations is high and if you need to leave your terminal for more than 15 minutes, log out, and let someone else get some work done.
  • No games, or inappropriate usage. Inappropriate usage also includes using the workstations exclusively as dumb terminals to telnet to other host machines.

Resources available

At all Monash campuses, there are X workstations provided for general student usage.

Disk space is limited. There are no quotas on user accounts, but users are strongly urged to keep their disk space usage to a minimum.

Keep temporary files in /tmp.

Use strip(1) to reduce the size of executables.

Don't collect a large amount of images in your account. Transfer to floppy disk via FTP from a personal computer any work you have finished with and you want to keep {see section 7.4}.

Getting to know X-Window System

When you first sit down to an X Windows workstation the screen will either show a small window with the message 'X Window System' and a login prompt, or the screen will be blank (meaning that a screen saver is active).

If the screen is blank, then move the mouse. If the screen then does not appear, the monitor may be turned off.

NOTE: It is safe to turn the monitor of a workstation on and off, but at no time should you turn the power to the workstation itself off. The workstation you are sitting at may be in use by someone else from a remote location.

At the login prompt, enter your account name, and password.

After a few seconds some windows will start appearing on your screen. One is labelled 'console'.

This is your UNIX shell (default csh).

If you exit this shell, your login session will end.

Another window will have the title 'messages', where periodically messages from the system will appear.

It will also show the latest message of the day ('motd').

On DECstation keyboards, the Escape key is F11.

On X Window workstations, a window manager controls how the windows react on the screen. It handles operations on windows such as moving, resizing, and iconizing.

In your account, a default window manager called twm is used - the Tab Window Manager.

Its behaviour is described below.

Along the top of each window is a title bar, containing the title of the window, and three icons:

 .-----.
 |=  / |    Iconise (reduces to an icon) the window.
 | =/  |    Click with the left button on the icon to restore it to
 |/  = |    its full size again.
  -----

 .-----.
 | --- |     Push the window behind all the others.
 | | | |     You can bring it in front of the other windows by clicking
 | --- |     on the title bar with the left button.
  -----

 .-----.      Resize the window. Hold down the mouse button, and drag
 |_||  |      the mouse ('click and  drag') to the edge of the window
 |__|  |      to first pick it up.
 |     |      Set the size of the window to what you desire and let go
  -----       of the button.

If you click and drag with the middle button on the title bar, you can move the window around the screen.

The right mouse button zooms and unzooms the window, to the full size of the screen.

Another feature of X Windows is the ability to cut and paste text between windows.

Using the left mouse button, click and drag out a region of text on the messages window. This text will be highlighted.

If you then go to another window, and press the middle mouse button, the highlighted text will be inserted as if you typed it yourself.

You can also select individual words by double clicking with the left button. If you double click again on a selected word, the entire line is selected.

Move the mouse pointer onto the background (this is also called the root window), and hold down the right button.

This brings up a menu of actions you can perform on windows.

A description of each effect is in the twm manual page.

On the root window, press the middle button.

This shows a list of windows to host machines you may be able to access. If you have an account on any of the machines listed, try to connect to it by selecting the machine.

Select sesame2 for now - this is the Monash Library's computerised catalog.

Soon, an outline of a window will appear, and the window manager will require you to position the outline and click a mouse button.

Every time a new window opens you will need to position it on the screen.

Running Some Programs

Press and hold the left button on the root window. A list appears of programs you can run. The manual page for each describe what they do.

While holding the mouse button down, move the pointer down to select xclock. As the name suggests, this is a clock for X Windows. After you position the new window, an analog clock face will appear.

Now click on the root window again with the right button, and select Destroy Window. The pointer will change into a 'skull and crossed bones' image. Click on the xclock window. This is one way to close undesired windows.

Some X Window programs close when you press CTRL-C, or Q when the pointer is in their window.

Another method is to kill the process from the console window as you would any other UNIX program.

A very useful X Window program is xterm.

This is a terminal emulation program.

As a simple example, go to the console window and type at the prompt:

        xterm -e man csh &

A new window appears containing the output of the command man csh. Xterm takes a regular UNIX program, and provides a window for the standard output to appear in.

Note: a program called xman is available, which provides a windowed interface to the UNIX man mechanism.

When you have finished your first login, go to the console window, and log out of that as you would log out from a dumb terminal.

The X Window System login window will reappear.

Getting help

If you have problems of any sort, either contact Helpdesk at your campus or send Email to helpdesk clearly stating your problems. Printing problems may be directed to the operators at the Computer Centre reception.

If you have problems with the CIPAG Image Processing library, send email to imagebugs.

There is also a newsgroup, monash.decstations, concerned with the X Windows service provided.

Announcements are made there, and if you have a general query, feel free to post and ask.