Physics Workstation Guide

Michael Ashley, Kristien Clayton, David Jonas

Comments/suggestions/corrections welcomed-please e-mail

Other sources of information

Physics IT Support:

Facilities guide:

Workstation software list:

School of Physics:


About this guide

This document gives a brief introduction to using the School of Physics workstations. It is by no means a complete guide, it simply aims to give you a few useful hints and to answer some common questions.

Unfortunately, much of the information contained herein is quite technical, and may be incomprehensible on a first reading. Hopefully, however, it will answer most of the commonly asked questions.

Introductory comments

As of this writing, there are several general-use workstations in the School. For workstation specifications please refer to the Facilities Guide which is available on the Web at

All of the Physics workstations are reasonably powerful facilities and can support many users simultaneously, with batch jobs having little impact on the interactive performance provided that the total memory usage of all jobs is less than the amount of physical memory available.

The workstations all run the UNIX operating system, which has a reputation for being terse and difficult to learn. Actually, UNIX is not much harder to learn than MS-DOS on an IBM-PC, but is much more powerful. It is well worth learning.

If you have questions about how to use the workstations, send e-mail to  or contact Vladimir Dzuba on x.5682. Queries regarding account creation and expired passwords in particular should be directed to Vladimir Dzuba. In most cases you should be prepared to find the appropriate documentation yourself and read it. This process is known colloquially in the UNIX world as ``RTFM'', which stands for Read The Fine Manual.

What can the workstations do for you?

Here are some reasons why you might consider using the School computers:

Of course, there are some disadvantages to the School computers, and most of them stem from the staff and budget that we have available to support them. The most important thing to remember is that you have to take responsibility for the safety of your own files and data. Backups are done regularly, but you should not rely on them. In general, if a disk crashes you will lose files, with no possibility of recovery. Another point is that if something breaks down a workstation could be out of action for a day or more.

For alternatives to the School workstations, refer to §[*].

Do you have to read this entire manual?

To use the School computers you don't need to know everything in this document (you should look here first if you have any questions, however). If you want to try the computers out, see §[*] on how to login, and type

most /usr/share/doc/handbook/book.txt

to view the FreeBSD handbook. The recommended editor is emacs (although see the discussion in §[*] on the choice of editors), and to start it up use


(note: if emacs says that your terminal is not powerful enough, try typing setenv TERM vt100, and then try emacs again). Next hit control-H followed by t to try a tutorial on editing. To exit emacs use control-Z. This suspends the editor and enables you to reconnect to it and continue editing where you left off by typing


Note the leading percent symbol, this instructs the computer to continue executing the most recently suspended job that starts with the letters emacs (in many cases, %e will be sufficiently specific). To logoff the workstation, type control-D or give the command


If you have a suspended emacs lying around, then logout will object, saying "you have stopped jobs". Just type control-D again to force a logout (although see §[*] if you wish to save files that you have been editing).

Finally, if you are familiar with either VMS or MS-DOS, then you should turn to §[*] for a comparison between UNIX and these operating systems and a table of command equivalences.


File names

File names in UNIX are arbitrary strings of up to 255 characters. If you wish you can have embedded spaces within the file name, and even control characters such as the ASCII bell. If you use such ridiculous names, however, you will find it very difficult to refer to them with normal commands (partly because UNIX commands typed at the keyboard assume that files don't contain spaces). If you need to transfer files between computers running different operating systems, you should use compatible filenames. As a general rule, restrict names to lowercase alphabetics or numbers, followed by a dot, followed by up to three alphabetics/numbers, e.g. file.txt, myprogram.f, thesis.tex.

Note that UNIX does not have version numbers like the VMS operating system.

It is important to realise that UNIX distinguishes between upper and lower-case characters, file.txt, FILE.TXT, and FiLe.txt are entirely different files. In general, it is best to use lowercase letters only.

A useful utility for renaming file is rename, a perl script that uses regular expressions to provide extraordinary flexibility in changing filenames. For example, to convert filenames from uppercase to lowercase, you could do

rename y/A-Z/a-z/ *
For help, run rename without any switches. For a broader understanding of the power of regular expressions look at the comprehensive PERL regular expressions page with ``man perlre'' or ``perldoc perlre''.

You can achieve similar results using standard UNIX commands. For example, suppose that you have a number of VMS Fortran files ending in `.FOR;1' and you want to convert them to the UNIX standard `.f' extension without the version number, then you could type (csh, tcsh)

foreach dummy (*.FOR\;1)
  mv $dummy $dummy:r.f

or (sh, bash, zsh)

for dummy in *.FOR\;1; do
  mv $dummy $dummy:r.f

Where dummy is a temporary variable which is used to hold the filenames to be processed, `:r' is a special syntax which says ``strip everything from the filename after (and including) the first period'', and the `.f' simply indicates to add a `.f' to the result. See man csh for more details.

Files that begin with a period `.' are treated specially by the ls command. In particular, they do not appear in your directory listing unless you use the -a (for all) option (i.e, ls -a). The reason for this is that such files are generally used during the operation of certain system commands. If they did appear in the directory list, users may be tempted to delete them to tidy up their directories, thereby causing all sorts of problems. As you get more experienced with UNIX you will learn what all the `.' files are for, but initially just leave them alone.

Displaying the contents of a file

To examine the contents of a file use the less command, e.g.

less thesis.tex

If the file is too big to fit on one page, less will display the first page and then wait for you to type a command. Commands are single characters, and do not require a carriage-return to terminate them. Type h to get a list of all the possible commands. The most common commands are the space bar to get the next full page of the file, carriage-return to go forward one line, b to go back a page, q to quit.

less is actually a locally added enhancement, and is an improvement on the usual UNIX pager more. One of the main advantages of less over more is that you can page backwards through pipes, e.g.

ps -aux $\vert$ less

will allow you to scroll up and down in the output from the ps -aux command, whereas more throws away output once you have read it. less also handles non-graphic ASCII characters better than more.

On an Xterminal you can use xless, which has a graphical user interface, instead of less.

Editing a file

The editor emacs is one of the more powerful and flexible editors available on the workstations. It is also a standard in the UNIX world. Use it! Equally powerful but somewhat terser is vi and its descendent vim (which stands for ``VI iMproved'')--since the command to exit the editor is impossible to guess, do not try using vi or vim until you have been enlightened by way of the commands man vi or man vim.

Alternatives are nedit (a nice X11 editor with pull-down menus in the tradition of Microsoft Windows), ed (a simple line-editor that is sufficiently similar to other line-editors that it can be picked up quickly), xedit (another Xterminal editor, an oldie from the standard MIT distribution), and joe (Joe's Own Editor--a simple full screen editor that has been specifically designed to be easy to use).


emacs has the advantage of being available on many different operating systems (e.g. MS-DOS, VMS, UNIX), and (with the possible exception of vi) is the most widely used and supported editor in the UNIX environment. emacs can be a bit daunting when you first come to use it, however, particularly if you see the 300 page manual (and the 600 page supplement). Nevertheless, emacs is a superb text editor and well worth learning. Fortunately there is an on-line tutorial (see below for details) which explains most of the commands you need to know to get going.

There are two ways of using emacs. The first is the traditional way of starting it up for each new file that you want to edit, e.g.

emacs file                ! not the best way to use emacs

You then edit the file, and when you have finished use C-x C-c (i.e. control-X followed by control-C) to save the file and exit emacs. There is a more efficient and convenient way of using emacs, though, and that is to start it up once at the beginning of your login session by typing


and then read-in a file to edit with the C-x C-f command. You can read in multiple files and edit them in separate windows on your terminal screen (if you have an Xterminal). When you have finished, type C-x s (i.e. control-X followed by s) to save the files, and then C-z to suspend emacs. If you type jobs you will see your emacs editing session listed as a stopped job. The trick is that you can now reconnect to that same copy of emacs and continue editing right where you left off. To reconnect to emacs, type


In fact, most times you could type %em or %e to reconnect (or even simply % if you have no other jobs), or %n where n is the number of the emacs job in the jobs list. See man csh for more details.

Don't make the mistake of starting a new emacs each time you want to edit a new file. Rather, reconnect to your existing emacs and read-in a new file with C-x C-f. You will find this is a much faster way of editing once you get used to it.

Anyway, once you have emacs running, try the on-line tutorial (which is very good) by typing C-h t. emacs makes a lot of use of the ``meta'' key, e.g. it may ask you to type M-x to perform some function. You can get the effect of the ``meta'' key by pressing and holding down the COMPOSE key on an Xterminal, or by pressing and releasing the ESC key (F12 on many terminals, or C-[ if you are really desperate).

Note: emacs finds out what sort of terminal you have by examining the environment variable TERM. emacs will refuse to begin an editing session if it thinks that your terminal is not powerful enough (e.g. it doesn't have the ability to scroll). This can happen if you login from a modem pool, in which case TERM is often set to network. To stop the problem (if you really do have a powerful enough terminal), try

setenv TERM vt100

One problem with emacs is that the author, Richard Stallman, has used C-q and C-s as commands. The difficulty with this is that these two characters are used by most terminals and computers for flow control (i.e. if a computer receives a C-s it stops sending output to the terminal until it receives a C-q). There are two ways around this problem: (1) to prevent the computer/terminal from interpretting C-q, C-s processing (also known as XON/XOFF), and (2) to tell emacs to use different characters for the commands that C-q and C-s would normally invoke. The former method is ideologically superior, but is often tricky to do, particularly if you are logged in via modems and terminal switches all of which can potentially intercept C-q and C-s.

Another problem is the backspace key. If emacs is run across an rlogin or telnet session and the keyboard used is IBM-compatible, it is possible that pressing Backspace will get you Emacs help (C-h). This is because IBM-compatible keyboards generate C-h when backspace is pressed (unlike other keyboards which generate the ASCII delete character). To try to get around this problem add the following command to your $ $/.emacs file before starting your editing session:

(keyboard-translate ?\C-h ?\C-?)

The above command remaps the keyboard so that backspace generates the expected delete character.


Files are stored in directories. Directories may have subdirectories, and so on without limit. When you login you will be in positioned in your ``login directory''. You can find out what files are in your directory using


which stands for ``list directory''. To get an extended list of the files, try

ls -l

which will tell you the dates the files were last modified, the number of bytes in each file, who has privileges to access them, and a few other bits of information. The ls command has lots of other options (for example, ls -lt will list your files in increasing order of age), see man ls for details. If the directory listing scrolls off the page, use less to page it, i.e, type ls -l$\vert$less.

If you are familiar with MS-DOS programs such as XTREE, you might like to try the UNIX program ytree. See man ytree for more information. Briefly, ytree gives you a graphical display of your files and directories in a form which you can easily navigate. If you like Norton Commander, give mc (Midnight Commander) a try.

To change your current directory, use the


command, which stands for ``change directory''. Some examples follow,

cd                ! returns to your login directory
cd ~mcba          ! goes to the login directory of user mcba
cd subdir         ! goes to the subdirectory subdir
cd ..             ! goes up one level of directories
cd /usr/local/man ! goes to the directory /usr/local/man
cd ~/tex          ! goes to the subdirectory tex in your login directory
cd ~/..           ! goes to the directory above your login directory
To compare with MS-DOS and VMS,
cd ~john/data                             ! UNIX
cd \john\data                             ! MS-DOS
set default sys$$login_device:[] ! VMS

Note that cd by itself under UNIX will return you to your login directory, whereas under MS-DOS it prints your working directory. To print your current directory under UNIX, type


which stands for ``print working directory''.

Note that there is no equivalent to the MS-DOS disk drive designators (A:, B:, C:, etc.) or the VMS disk names (CSDVAXDBA0:, CSDVAXDBA1:, etc.). This makes for a much simpler and more logical file system structure. In UNIX, disks are mounted as parts of the file system, e.g. /usr/users is a directory which contains many subdirectories, several of which are actually other disks. In general you don't need to worry about this. You can use


to find out where the disks are mounted, and how much room is available on each disk,


to obtain details of the amount of storage that you are using from the current directory downwards, and

du -sk ~

to get a report on the total amount of space your home directory is using.

Copying, renaming, and deleting files

To copy a file use

cp file.out       ! where file.out is the output file name
cp thesis.tex ~jtp/tex    ! if ~jtp/tex is a directory, then the new
                          ! file will be called ~jtp/tex/thesis.tex
To rename a file

mv ! mv stands for move

Note that on the Physics workstations the default behaviour of cp and mv has been altered so that these commands will prompt you before overwriting existing files. You will find that this is not the case on any other UNIX system on campus.

To move a lot of files to another directory

mv data.* ~/subdir
Note that you can not rename files by doing things like mv DATA.* data.*. If you want to do things like that, have a look at the rename command and/or read man tcsh/man bash carefully.

To copy an entire directory tree do

(cd old_dir; tar cf - .) | (cd new_dir; tar xpf -)

To delete a file

rm                ! rm stands for remove

Note that this command will ask you whether you really want to delete the file. Answer y if you want to, just hit carriage-return if you don't want to. On most UNIX systems the rm command will not prompt you, and will quietly do its job. To force the deletion of some files (useful in the case that there are many files that you wish to delete, and you don't want to answer y to all of them), do

rm -f *.dat

where the -f stands for ``force''.

File protection

UNIX allows you to choose who can have access to your files. File have three types of permissions: read, write, and execute (abbreviated r, w, and x). Normally you have read and write permission on all your files, and read, write, and execute permission on all your programs and on directories (a directory must have execute permission otherwise you can't search it for filenames). When a person tries to access a file, UNIX distinguishes three types of people: the owner of the file, people in the same group as the owner, and everyone who is not in either of the first two categories. You can decide, as the owner of the file, what permissions you give to the three classes of users. To find out what the permissions are, use the following command

ls -l myfile.tex

which will result in a line something like

-rw-rw-rw- myfile.tex

The first strange group of 10 characters is the permission matrix for the file. The first character is special, don't worry about it for the time being (if it is `d' the file is a directory). The next 9 characters are the read, write, and execute permissions for the owner, the group, and others (i.e. everyone else), respectively. To change the permissions to something else you need to use the chmod command (stands for ``change mode''). There are two ways of using chmod: the first is to specify the file permissions absolutely using a three digit octal number, and the second is use a mnemonic argument to add or subtract individual permissions.

To explain the octal code method, imagine the 9 last characters of the permission matrix as representing the bits in three octal numbers, for example, rw-rw-rw- would be 666, rwx--- would be 700, rwxr-xr-x would be 755, and so on (don't be worried if this sounds too complicated, there is an easier method to use which will be explained shortly). Now, to make a file accessible to users within your group (normally those within your department), use the command

chmod 640 file

which will change the permission matrix to rw-r---, which means that you can read and write the file, members of your group can read it, and everyone else has no access. You can use wildcards in the file specification to change the mode of many files at once.

To find out which group you are in, use the id command. To find out who else is in your group, look in the /etc/group and /etc/passwd files. The command

ls ~/..
will give you a list of all the people in your default login group. Note that you can belong to more than one group. You can display the group associated with a file using

ls -lg

and you can change the group with the chgrp command (see man chgrp for more information). If you wish to change the groups that you are in, or would like to set up a new group for some purpose (such as sharing files) then send mail to with your request.

To allow all users read access to one of your directories, use

chmod 755 dirname

The default permission for the Physics' workstations is 600 for normal files and 700 for directories1, which means that no other users can read or write your files (although you top level directory will most likely be readable by people in your group). If you like, you can change the default permissions by editing your .login file. 600 is good for security since it means that if you are working on sensitive documents, the files you create will automatically have maximum protection. It is a real nuisance, however, if you want to share files with other users.

One thing to watch out for is that if someone has write permission to a directory, then they can delete any files in that directory whether or not they have any access to the individual files.

The alternative (and usually more convenient) method of using the chmod command is to use the mnemonics u, g, and o for user (i.e. you), group, and other, respectively, and r, w, and x for read, write, and execute, and = to set permissions, and $+$ and $-$ to make relative changes. For example,

chmod go$+$r *

will set read permission for all users except yourself (i.e. group and other) for all files in the current directory.

chmod u$+$x file

will make the file executable by you (this is often used to allow you to run shell scripts by typing the filename). A more complex example, albiet not a particularly useful one is

chmod -R u$+$w,g-r,o$=$rwx *

which will add write permission for you, take away read permission for users in you group, and give all other users read, write, and execute permission on all the files in your current directory and all lower directories (that's the meaning of the -R, for recursive, option).

It often happens that you want to give users in your group read access to a directory tree (i.e. a directory and all files/directories below it), and execute access to any programs that happen to be there. To do this, type

chmod -R g=u,g-w directory

which recursively gives everyone in your group the same access as you have, and then removes write access. If you want everyone to have access, simply replace the g in the above example with go, for `group and other'.

Giving another user access to a file

It often happens that you need to give another user access to one or more of your files. There are many ways of doing this, for example, the file can be mailed if it is a text file and small, or you could deprotect the file (and the directory in which it is stored) using the chmod command in the previous section. Sometimes the easiest way of giving a file to another user is to simply copy the file to the /tmp directory (which everyone can read) and deprotect it. The user who wants the file should use the mv command to ``move'' the file from /tmp to avoid extra copies lying around. For example,

cp ~user1/file_to_share /tmp            ! copy the file to /tmp
chmod 666 /tmp/file_to_share            ! deprotect the file so it can be read

mv /tmp/file_to_share ~user2/           ! the other user now copies the file
chmod ??? ~user2/file_to_share          ! protect the file as desired

Backing up files

All operating system and user file systems on ugrad, newt, and lizard are backed up on a regular basis to tape. Some scratch file systems including /var/tmp and /scratch may not be regularly backed up.

Backing up to CD and DVD

Some workstations have CD-R/RW or DVD-RAM facilities--contact Physics IT Support to arrange use. Note that you will be required to supply your own media. The Physics Store and local campus stores such as the Quad Store sell removable media.

Owing to CD/DVD limitations in maximum file length and permissible characters, it is wise to zip (PKZip) or tar (Tape Archive) files on the source operating system and then simply write the zip or tar file to CD or DVD.

For example to write a new file containing all the files in your login directory and all subdirectories below it, use

(umask 077 && tar cf /scratch/home.tar ~) ! Copies your directory to /scratch/home.tar
the c option to the tar command stands for ``create'', and means that you are creating an archive, the v option stands for ``verbose'', i.e. tar lists the filenames on your terminal as it writes them to tape, the f option allows you to specify the file or device that you are writing to.

Backing up to tape

Some workstations have tape devices that may be available for general use; contact Physics IT Support for information regarding tape drive availability. To write your whole home directory contents to tape, use

tar cf /dev/nsa0 ~ ! Copies your directory to a tape in /dev/nsa0

/dev/nsa0 stands for ``no-rewind mag-tape number 0, default density''. The significance of the ``no-rewind'' is that after the operation is completed, the tape doesn't rewind to the beginning of the tape (as it would if you specified /dev/sa0).

To understand how to read/write tapes you need to know something about the format of data on tapes. A tape begins with a beginning-of-tape marker, and ends with an end-of-tape marker (usually pieces of reflective metal foil on the tape). Data is written as 8-bit bytes in records of user selectable length. Records are delimited by inter-record gaps. A file consists of one or more records, and is delimited by a tape-mark (a special pattern of magnetisation on the tape that can not be duplicated by data). The last file on the tape has two tape-marks after it, and this serves to indicate the logical end-of-tape (as opposed to the physical end-of-tape, which is indicated by the end-of-tape marker).

When you write data to a tape, you must start either at the beginning-of-tape, or immediately after a tape-mark. Any data that was on the tape after the starting point is irrevocably lost. It is not possible to extend tar archives by writing new records before the end-of-file tape-mark.

To move around a tape, you use the mt command. For example,

mt -f /dev/nrmt0h rew        ! rewinds the tape
mt -f /dev/nrmt0h fsf 1      ! moves forward by one file-mark
mt -f /dev/nrmt0h bsf 2      ! moves backwards by one file-mark
Note that you must use the ``no-rewind'' magnetic tape device, otherwise the tape will rewind itself after performing any mt command.

The tar command produces an archive of the files and directories that you request, and writes the archive as one file on tape. After writing the file, tar writes two tape-marks (to indicate the new logical end-of-tape position) and then positions the tape between the two tape-marks. You can then write another tar archive by simply issuing another tar command immediately after the first.

If you wish to add a tar archive to the end of tape that has been rewound, you need to first position the tape after the last file by using

mt -f /dev/nrmt0h fsf n
where the number ``n'' equals the number of tar archives on the tape. If you don't position the tape correctly prior to writing then you will lose all the information that existed downstream of your starting point.

To restore files from a tar archive to disk, you first position your working directory to where you wish the files to be written, then position the tape to the tar archive you wish to use, and finally use a tar extract command, e.g.

cd ~/data
mt -f /dev/nrmt0h fsf 4
tar xpf /dev/nrmt0h

Note that you should take extreme care when using tar since it is easy to overwrite all your files. For example, if you accidently use the ``c'' option rather than the ``x'' option when trying to extract files from a tape archive, you will irrevocably damage the tar archive on tape (unless you have the ``write protect'' switch set on the tape cartridge), and it will be exceedingly difficult to recover any information downstream of the error.

We also have gtar available which is GNU's public domain version of tar. In general gtar is superior to tar, particularly in its ability to read tapes that have a few errors on them, and in saving files with long filenames, and in numerous other ways. So, instead of using tar in all the above examples, use gtar instead.

A convenient way to backup small files is to compress them (to reduce the space requirements) and send them to another computer (e.g. Astro--and don't forget to use a binary mode of transfer). This is a very sensible thing to do if you are working on important documents. To compress a file, use

gzip myfile.tex

this will create a file called myfile.tex.gz which is often significantly smaller than the original file. To uncompress the file, use

gunzip myfile.tex.gz

and to send the file to another computer, see §[*] on file transfer. To send a bunch of files, make a tar saveset of the files, gzip the saveset, and then ftp it:

tar cvf junk.tar mydirectory
gzip junk.tar
scp junk.tar.gz

Also available for compressing data is bzip2. This can yield higher compression than gzip and is also available on most UNIX systems. To compress a file using bzip2, use

bzip2 myfile.tex

which will create a file called myfile.tex.bz2. To uncompress the file, use

bunzip2 myfile.tex.bz2

You can also produce gzip or bzip2 tar archives directly by using gtar and the z or j flags, respectively (on newer operating systems such as FreeBSD 5.1 tar and gtar are one and the same). For example,

gtar cjvf junk.tar.bz2 mydirectory

will create a bzip2 tar archive junk.tar.bz2, which may later be decompressed and the contents extracted using

gtar xjvf junk.tar.bz2

Buying media for backups

To purchase CD-R/RW media try the Physics Store, or one of the campus stores such as the Quad Store. Some campus stores will also stock DVD media compatible with DVD-RW/RAM--hunt around.

To purchase a tape for use in the DDS-4 drive, try Comnet Solutions. Do not be tempted to use cheaper tapes (ones that are not specifically designed for storing data) since they may cause damage to the tape drive.

Finding files

Suppose that you have a complex directory tree and somewhere in it you have some data files called data.001 through data.009 that you want to locate. This is done with the find command. First position yourself at the top of the directory tree, then run find. For example,

cd ~/datafiles
find . -name "data.00[0-9]" -print

If you expect pages of output from the find command, then simply pipe the output to less using

find . -name "data.*" -print|less

Note: you should give find as much assistance as possible by positioning yourself as low down in the directory tree as you can, to reduce the number of directories and sub-directories that find has to look through. Additionally, using find on an NFS-mounted filesystem is exceedingly inefficient and results in an enormous amount of network traffic: to avoid this, use find on the computer that has the filesystem mounted on a local disk.

The tree (print a tree listing) and locate (find files by pattern) commands can also help you find files. In particular,
tt locate uses a periodically regenerated hash function database generated from the output of the find command, so it may be hundreds of times faster than find. To use locate to find all files matching the pattern *chapter1.tex*, run

locate chapter1.tex

Disk quotas

Currently we do not have disk quotas enforced since there is an adequate amount of space available. To make this work we require a cooperative spirit from users to keep their file usage to a reasonable minimum and to delete unwanted files.

Scratch disk space

On some workstations there is an area called /scratch, with gigabytes of space. As its name implies, it is not designed for long-term storage of data. You can use this to store data/programs/whatever during the week. Along with /var/tmp this file system is not backed up during regular system backups. Once data is lost from scratch there is no way of recovering the data, so please be careful. Here is a list of scratch file systems available on various workstations:

Workstation name Directory name
ugrad /scratch
newt /scratch
lizard /scratch

Do not store files in the root directory (/scratch. Create a directory for yourself and place your goodies within that directory only. A command such as this should do the job:

(umask 077 && mkdir /scratch/$USER)

The subshell (()) and umask 077 command ensures a private directory mode that does not invite others to examine your directory contents.

Data disk space

Some workstations have data space in addition to home directory and scratch space. You can store things such as datasets and checkpoint data in these data file systems. Data file systems are backed up. Here is a list of data file systems available on various workstations:

Workstation name Directory name
newt /data
lizard /data

As per /scratch please do not store files in the root directory. Instead, place your data in a subdirectory created using a command such as,

(umask 077 && mkdir /data/$USER)


Various PostScript laser printers are available throughout the School. To find a definitive list of the available printers, have a look at the file /etc/printcap (the ``printer capabilities'' file). As of this writing, the following printers are available in the School of Physics:

A Hewlett-Packard LaserJet 4000N in Room 1Q12 outside the Third Year Laboratory on the second floor. Duplex capable via queues p206d (long edge duplex) and p206ds (short edge duplex)
A Hewlett-Packard 2300DN outside the Second Year Laboratory on the first floor.
A Hewlett-Packard LaserJet 4050 in Room 129, Astrophysics. Duplex capable via queues p62fd (long edge duplex) and p62fds (short edge duplex).
A Hewlett-Packard LaserJet 5MP in Room WG8 (Newton Building) for use by CMP only.
A Hewlett-Packard LaserJet 5MP in Room 14/15 in Biophysics for use by Biophysics only.
A Hewlett-Packard LaserJet 4300N in Room 61. This printer is for use by staff and postgraduates only. Duplex capable via queues p61d (long edge duplex) and p61ds (short edge duplex).
An Epson Stylus Photo 760 in Rm 7. Use 720 DPI 'Draft' mode for draft work and 1440x720 DPI for proofs. Those unfortunate enough to be stuck with Windows 9x/ME must install a driver on their PC for this printer and then they must setup default options. People who use WinNT based operating systems or Unix with CUPS should make use of the NEWT-PHYS p105 queue which comes with its own driver. Refer (see §[*] regarding control of this printer from NEWT.

The laser printers accept PostScript files only. Colour printers accept either PostScript or Epson ESC. You can recognise PostScript files by the fact that their first line usually starts with the characters %! and their contents look a bit like a terse programming language (PostScript is). Also, the file name usually ends with .ps. If you try to send any other sort of files the printer may ignore them, and you won't get any indication of what happened. To display a PostScript file on an Xterminal before printing it, use GhostScript (i.e. gs, or ghostview (i.e. ghostview

Important note: laser printers are expensive devices on which to print so please try and keep your usage of them to the necessary minimum. It is particularly unfriendly, for example, to print out numerous copies of a long article or thesis chapter simply to correct a small typesetting error on page 43. Also, don't use the laser printer as a photocopier. Use options on your software to only print those pages that you want (e.g. dvips -n1 -p43 chapter16 will print one page beginning at page 43 of the file chapter16.tex).

The command for printing files is lpr. You specify the printer that you want to use by using a command-line switch (e.g. -Pp206), or by setting the environment variable PRINTER. The default printer is ``p206'' on Ugrad and p61 on Newt..

Printing examples

Some examples will make the syntax clearer:

To print a text file to PostScript printer p3, use

To print on the line printer, use

lpr -Pline file.txt

a2ps file.txt | lpr -Pp3

To print a PostScript file to the default printer (usually ``p206'' on Ugrad and ``p61'' on Newt) use


to print on the HP LJIII in the second year lab, use

lpr -PHP2

To change the default printer from p206 to, say, p59, do the following

setenv PRINTER p3

which will affect all lpr commands in the current login session. Put the above line in your .login file if you always want to use this printer. Users of Bourne Shell or derivites such as bash should use the following instead

export PRINTER=p3

Printing text with a2ps

To print an ASCII text file on a laser printer, you have to convert the text to PostScript first, and you can do this with the program a2ps. For example,

a2ps shortprogram.f | lpr

will convert the ASCII text file shortprogram.f (presumably containing the text of a small Fortran program) into PostScript, and pipes the result to the printer (see ``man a2ps'' for a list of all the options that a2ps supports).

Printing text with enscript

The enscript program is also useful for printing text and program listings to PostScript printers. Here are some examples of switches to place after the enscript command:

Options to enscript Effect
-G2rE -U2 -color -o prog.c Gaudy headers, 2 columns, rotate:Landscape,
  syntax highlight, 2-up, colourise,,
-U4 -Pp61 -fAvantGarde-Book@10 eig.f 4-up, output:printer p61, font:AvantGarde 10pt,

See ``man enscript'' for a list of all the options that enscript supports.

Controlling print quality, media type, and duplexing

Below are some examples demonstrating options that control specific printer settings such as duplexing.

To print on the Epson colour printer p105 using 1400x720 DPI high quality mode with transparency media:

lpr -Pp105 -oResolution=1440x720hq2 -oMediaType=Transparency

To print to printer p206 using 'no tumble' duplexing:

lpr -Pp206 -oNoTumbleDuplex

The options available with the -o switch demonstrated above depend on the printer model. Options may be listed using the ``lpoptions'' command as per this example (note the unfortunate use of lower case 'p' instead of the lpr-style upper case 'P' to specify the printer):

lpoptions -pp105 -l

The lpr command works by copying the file you specify to a special place on the hard disk and adds it to the queue of files to be printed (so any modifications that you make to the file between typing the lpr command and when the file is printed do not appear on the printed output). You can examine the queue for the default printer with


or use

lpq -Pp206

for printer p206, and you can remove files from the queue with

lprm job_number

which takes an optional argument giving the number of the file in the queue (obtained from the output of lpq), e.g.

lprm 7823

will remove job number 7823. As you would expect, lprm can be used with the -P option to delete files from other print queues.

To print text from Emacs use M-x ps-print-buffer or M-x ps-print-region. This will convert the active buffer or region contents to nicely formatted PostScript and send it to the default printer specified by the PRINTER shell environment variable. To find out more about M-x (the ``Meta'' key) refer to section §[*].

Problems with printing

It occasionally happens that you may submit a job to the printer and nothing comes out. If your job has disappeared from the queue (as found by using lpq), it may still be being processed by the printer (some of which have large input buffers). If your job is still in the queue but has not printed there is no point submitting it again. Resubmitting the job will merely cause your job to be printed multiple times when the print queue resumes. You can determine what the laser printers are up to by examining their status displays or LED's. In some circumstances you may need to reset an HP printer by pushing the off-line button and then pushing (and holding for a few seconds) the continue/reset button. Other points worthy of note:

To check whether your file is a valid PostScript file, you can preview it on an Xterminal using gs gs stands for GhostScript, and is a public domain PostScript previewer written by GNU. ghostview and gv are graphical interfaces to GhostScript, and may be prefered by some people.

Saving paper

Below are some ways that you can help save printing resources when using UNIX.

When converting text to PostScript it makes sense to fit multiple pages per physical sheet. For example, to print four pages per physical sheet of paper from the document matmul.f into a new file called

a2ps -4 matmul.f >

Printing multiple pages per physical sheet saves time (and paper of course). For example, to print four pages per physical sheet of paper from the document and save them into a new file called

psnup -4 >

Acroread can be used as a filter to produce PostScript. For example, to output the PDF document bib.pdf as a 4 page per sheet PostScript file:

cat bib.pdf | acroread -toPostScript | psnup -4 >

Don't print an entire document simply to correct a minor typographical error on one page. For example, to generate one PostScript page beginning at page 43 of the file chapter16.tex and save it into a new file called

dvips -n1 -p43 chapter16

ghostview, gv
If you need to print a range of pages in a PostScript document there is no need to print the entire document. View the document using ghostview or gv, then in the page index highlight the pages you wish to print and choose Print marked pages.

If you know the page range then the same can be achieved from the command line using psselect. For example, to extract pages 8-26 and 31-38 of the file and save them into a new file called

psselect -p8-26,31-38 >

To print on both sides of the paper on duplex capable printers p206, p62f, and p61 add 'd' (long-edge duplex) or 'ds' (short-edge duplex) to the queue name. For example, to duplex print

lpr -Pp206d

On Ugrad and Newt the same can be accomplished using the -o option switch and DuplexNoTumble (long-edge duplex) or DuplexTumble (short-edge duplex) to lpr with the regular queue name. For example:

lpr -Pp206 -oDuplexNoTumble

Some printer drivers support pages-per-sheet via job control options. For example, to print two pages per sheet in landscape (wide) orientation on ugrad or newt try,

lpr -Pp61 -oHPNup=TwoUpL

Use ``lpoptions -p<printer> -l | grep -i sheet'' to list available pages-per-sheet configurations.

Computers that print via NEWT-PHYS (the Samba service on newt) can take advantage of the pages-per-sheet feature without any local support for this layout feature. See your printer software printer options to enable this feature. For example, in Open Office the menu tree to access pages-per-sheet is:

	File >
	  Print >
	   Properties >
	    Device >
	      Pages per sheet: 2 (Landscape)

This is quite similar to the menu tree available to Microsoft Word users printing via NEWT-PHYS:

	File >
	  Print >
	   Properties >
	    Advanced >
              Printer Features >
	        Pages per Sheet: 2 (Landscape)

A warning regarding a2ps and enscript. Please don't send PostScript files through either of these programs or much paper could be wasted. Files in PostScript format should be sent to PostScript printers as per the lpr examples above, or treated using utilities such as psnup or psselect and then sent directly to PostScript printers.

UNIX miscellany


You identify yourself to the operating system with your username. Normally your username will be your initials or your student number, and it must be entered in lowercase. To find out who is logged onto the computer, use one of the commands u, w, who, wh or finger (which can be abbreviated to f). To find out who is logged on to a remote computer, use finger as in the following example:


Most sites disable the finger service so its usefulness in probing remote sites is greatly diminished.

To change the information displayed by finger for your username, use the chfn command. Please do not alter the name that finger displays to something stupid since doing so is silly and inconveniences other users who may need to speak with you if, for example, you have a tape drive allocated.

If you merely wish to check your user identification and group membership on the local workstation use the id command without any switches.

Non-standard features of UNIX in the School

There are several non-standard features of the local implementations of UNIX on the School workstations that you should be aware of. The most important ones are:

If you don't like the way these commands have been aliased, then you are free to change them in your .cshrc file. You should also have a close look at the .login, /usr/local/.cshrc, and /usr/local/.login files. Note, however, that if you elect not to run the system default .cshrc and .login files then you will get no sympathy if you have problems (e.g. if the local directory for TEX changes).

Control characters

In similar fashion to other operating systems, UNIX interprets some control characters that you type in a special way. Here is a list of the default settings. You can change some of these using the stty command, and you can print out a list of the current settings using stty -a. There are also many special control sequences which you can use to edit command lines, see man tcsh for a complete list.

Character Name Description
Up arrow   recall previous command in the history list
Down arrow   recall next command in the history list
Left arrow   move within the line, for editing
Right arrow   move within the line, for editing
DEL erase erases the character before the cursor
^A   moves the cursor to the beginning of the current line
^E   moves the cursor to the end of the current line
^U kill deletes the command line you are entering
^C intr trys to kill the current job
^$\vert$ quit trys to kill the current job, writes a core file
^D eof end of file character,
    also used to terminate invocations of the shell (e.g. to logout)
^Q start starts output that was previously stopped by ^S
^S stop stops output going to the terminal
^Z suspend suspends the current process, you can then use fg
    to put it in the foreground, bg to put it in
    the background, or kill to kill it off.
^O   throws away output to the terminal until the next ^O.
^R   retypes the command line you are entering

Miscellaneous useful commands

date displays the current date and time
df examine the amount of free disk space
ftp file transfer across ethernet
history lists the previous commands that you typed
jobs lists jobs you have running in your current login session
logout to logout
man on-line documentation
nslook query for machine names and internet addresses
passwd allows you to change your password
ps -x list all the processes that you have running
ps $-$aux$\vert$less list all the processes running on the system
slogin to securely login to remote computer
ssh to securely run a command or login to a remote computer
scp to securely copy files between computers
telnet to login to remote computers
who gives a list of who is logged in

What is a shell?

UNIX manuals quite often talk about the ``shell'', and it sounds like some sort of mysterious entity. It isn't really. The ``shell'' is simply the program that you are running when you are entering UNIX commands. Normally you think of computers running programs such as big Fortran packages, however, even when the computer is not running one of your programs it is still running something (otherwise it wouldn't be able to communicate with you). This program is called the shell. On other computers it is sometimes called ``the operating system'', although there is more to the UNIX operating system than just the shell.

UNIX gives you a number of different shells to choose from. Common ones are the Bourne shell, the C shell, and the Korn shell, all of which are available on the Physics workstation. By default the shell that you will be running is called tcsh, and it is an improved version of the C shell.

So what does the shell do for you? Its most useful feature is the maintenance of the history file (containing the last 20 or more commands that you have typed) and its ability to let you edit and resubmit previous commands by using the arrow keys. Try using the up and down arrow keys to move around the history list. Use the left and right arrow keys to move within a command. You can edit a command by using the delete key and inserting text. Resubmit the command by typing carriage-return (you don't have to be at the end of the line to do this).

Another very useful feature of tcsh is filename and command completion. To explain, suppose that you want to perform the operation

less ~/tex/thesis_chapter2_part5.tex
Rather than typing out the whole filename you only have to type the characters at the beginning of it that are unique, and then hit the TAB key. When you hit TAB, tcsh fills in the rest of the filename for you (or beeps if it can't find the file or if there are multiple choices) If there is more than one file that matches what you have typed so far, tcsh will fill in as much of the filename as it can, and then beep for you to respond with further characters. You can type ^D at any time to see a list of all the possible files that match what you have typed so far.

The shell has numerous inbuilt commands (such as jobs, fg, bg, time). To find documentation on these commands use man csh and man tcsh.

If a command isn't recognized by the shell, it is then assumed to be a UNIX system command and is searched for in the directories listed in your PATH environment variable. Type printenv PATH to see what PATH is currently set to.

UNIX equivalents to autoexec.bat,

Most computer operating systems have a way of executing a file of commands when you first login. With MS-DOS you have an AUTOEXEC.BAT file, with VMS you have a LOGIN.COM file. UNIX is no exception, and the file is called .login. Everyone has one of these files in their login directory. To examine it type

less ~/.login
to make it show up in a directory listing, you have to use the -a switch on the ls command, e.g.
ls -a ~
The .login file is executed every time you login (you can also create a .logout file if you wish--it will be executed when you logout). In addition, there is another file, called .cshrc (which stands for C shell run commands) which is run every time you start up an invocation of the UNIX C shell (which occurs almost every time you type a command, see the discussion on shells in §[*]). You should take care what you put in your .cshrc file since it is an overhead on every command that you type.

Input/output redirection

For each program that you run UNIX assigns three input/output ``streams'' to it. They are

You can reassign these streams to be files or devices (such as magnetic tape drives). For example, the command

ls -l

will list all the files in your current directory. The output of the command will appear on your terminal screen. To redirect it to a file, use

ls -l > filename

Note that you don't have to put spaces around the $>$ character. To redirect standard input use the $<$ character, and to redirect standard error as well as standard output use $>$&. To append to an output file rather than to truncate it, use $»$ and $»$&. To stop for user input in a shell script, use $«$. If the file that you want to write to already exists, then you should put an exclamation mark after the $>$ or $>$& to force the shell to overwrite the file (see man csh for information on the ``noclobber'' shell variable that affects this behaviour). When using an exclamation mark in this manner, you need to put a space after it to avoid the shell interpretting it as a request to extract text from the history list.

As a final example, suppose that you have a program called model which normally requires input from your terminal, and writes its output to the screen. To force model to take its input from filein and write its output to fileout you would type,

model <filein >fileout
See man csh for the definitive discussion on input/output redirection.


To direct the standard output of one program to the standard input of another you use a pipe, represented by a vertical bar. For example to search the process list for jobs belonging to a particular user, you can use

ps -aux|grep user
where the output of the ps -aux command (which lists all the running processes), is piped to the input of the grep command which prints out those records which contain the word user. You can have multiple pipes on the one command line.

It is worth knowing about the UNIX program ``tee''. This program accepts a filename argument, and makes two copies of its standard input: one goes straight through to the standard output, and the other goes into the file. For example, suppose that you wanted to keep a log of a telnet session to a remote computer, then you could type

telnet | tee logfile


Security is a very important issue. If you use the workstations for processing any sensitive information (such as references you have written for people) then you should thoroughly understand the security implications. Some of the more important points are:

And now for some comments on passwords.

The workstations are connected to the University Wide Network, and thence through AARNET to the world. Anyone on over a million computers around the world could attempt to login. The only thing that stands between malicious hackers and your files is your password, so it is vitally important that you choose it carefully and change it often. Passwords should be long (say 8 characters), they should not be something obvious like your name or birthday or telephone number (or those of your wife/husband/girlfriend/etc), they should not be any English word, and they should ideally contain a few odd characters like $, %, &, numbers, spaces, and so on. To set/change your password, use the passwd command and follow the instructions it gives.

When you enter your password when trying to login, UNIX takes the first 16 characters and passes them through a one-way encryption algorithm to generate an 18 character string. The encrypted string is then compared with what is stored in a special file, and if it agrees, you are allowed to login. We are operating with ENHANCED C-2 level security, which is much more secure than most UNIX systems. Normal UNIX security is vulnerable to attacks from password guessing programs such as cops and crack.

As part of security, UNIX will force you to change your password every six months or so. If you don't login during a certain period (currently set to 70 days) immediately before operating system decides to do this, then you will not see the warning message that asks you to change your password, and will therefore not be able to login. If this happens, see Vladimir Dzuba for a new password.

As a general rule, never let anyone else use your account. A common situation is when an academic has a student collaborator, in this case the student should have a separate account, even if the time period of the collaboration is only a few days.

Note for undergraduates, hackers, crackers, and game players

The Physics workstations are for research and teaching in Physics. Activities such as attempting to overcome the security measures, reading other people's files (even if the files are inadvertently read enabled), manipulating disk space or batch jobs in an attempt to obtain an unfair share of the computer, gratuitously using terminal locking programs, reading/writing to other people's Xterminals, running network packet sniffers, deliberately disabling terminals (by, say, fiddling with colour alignment or setting the keyboard type to Norwegian), tampering with another user's account should you find the user logged in on an unattended Xterminal, playing games of any sort, storing password files for other computers, collecting pornographic GIF images, using the laserprinters for non-Physics purposes, using the Internet for non-Physics purposes (e.g. IRC or MU* at any time of the day or night, swapping PC programs), and so on, will be most unwelcome and will result in the permanent loss of your account with no warning. This has happened to quite a few undergraduates in recent years. These rules are not arbitrary restrictions, but have resulted from experience with people abusing the system in ways that has seriously impacted the ability of our researchers to get work done.

Particularly serious infringements can result in suspension of access to computing facilities, a fine or exclusion from the University for a period. For rules relating to use of computing factilities at UNSW please visit

Login messages: motd and notice

When you login to a Physics workstation you may see some introductory messages printed on your terminal. These fall into two categories: the message of the day, and messages from the notice program.

The message of the day or motd is a notice which may be displayed when you first log in. It can contain important messages regarding system use or upcoming special system events.

The notice program was written by Michael Ashley to allow individual users to post announcements that appear when people login. The announcements appear as one-line messages, with the option for additional text being associated with the message. The announcements appear as one-line messages, with the option for additional text being associated with the message. Notices have a number, and if the one-line message contains a plus sign (`+'), then you can obtain more information by typing notice number. Notices are posted to one of a number of different groups (e.g. astro, bio, theo), and you can choose which groups you subscribe to. For more information about notice type notice -h.


There is a great deal of documentation available on UNIX. Most of it, however, is rather cryptic, and you will find that it takes quite some time to understand it.

On-line documentation

To obtain help on a command, use the on-line UNIX manual, e.g.

man ls

will give you information on the ls command (if you have an Xterminal, use xman instead--see below). A useful option is -k (the k stands for ``keyword''), for example,

man -k print

will give you a list of all the commands that man knows about whose one-line descriptions contain the word ``print''. The command man -k is aliased to the command apropos, so you can type

apropos print

as well, if you think it is any easier.

Sometimes you will find that you can't find help on a given topic which you think should be available. This may mean that the command is part of the shell, in which case it may be described by using man csh, or man tcsh.

See man man for more information on using the on-line manual pages.

If you are using an Xterminal you can use


to examine the man pages in a faster, more convenient, form than by using man itself.

Printing man pages

You can generate hard copies of man pages by piping them through the groff utility.

Here is an example which prints the gzip compressed man page for dbx to the default printer:

zcat /usr/man/man1/dbx.1.gz | groff -Tps -man - | lpr

Of course, for this to be effective you need to know where the man pages are stored in the file system. Generally they live in either /usr/share/man/man? or /usr/local/man/man? where ? is the man section number. The section number can be found by using the regular man command to view the desired man page--the first line of output from the command includes the section number in parentheses.

GNU info

Some packages have "info" pages which can be accessed from Emacs' info mode (M-x info) or by using the standalone info browser, e.g.

info tar

Here are some useful info browser keystrokes (C- means hold down Ctrl while pressing the indicated key):

Key Action
d Return to top level directory
p Previous node
n Next node
C-h Help
C-x  2 Create new window (split)
C-x  0 Close window (unsplit)
C-x  o Next window
q Quit

Certain GNU packages have man pages which are out of date or do not exist--current documentation for such packages can normally be found in the info pages.

On-line tutorials



to try some on-line tutorials (use control-C to abort them if you have had enough). Note, however, that the on-line tutorials are not particularly useful (the ones on ``files'', ``morefiles'', and ``C'' are probably the best).

vilearn can be used to learn about the editor vi. emacs has an inbuilt tutorial accessed with C-h t.

Printed documentation

Information on Digital UNIX is available in HTML form--using netscape you can open Bookmarks and select Digital UNIX InfoCenter, or go to the location file:///usr/doc/netscape/Digital_UNIX.html. Manuals for the HP LaserJet III and other peripherals, as well as locally added software such as IRAF, are available by asking Michael Ashley.

The ethernet

Many locations within the School are wired with thin-wire ethernet outlets. Each outlet is on a segment of ethernet--there are many segments in the School, all connected through ``multiport transceivers'' to a thick-wire cable, and thence to a fibre optic line with the campus-wide network. A segment is a single line of RG-58A/U 50 ohm coaxial cable up to 185 metres long, and terminated with a 50 ohm resistor at one end, and a ``multiport transceiver'' at the other. Wall plates allow you to connect devices to a segment. There are two types of wall plates: those in the middle of a segment, which have two sockets, and those at the end of a segment, which have one socket.

The important wiring rules for the ethernet are as follows:


As of this writing there are about 100 Xterminals within the School. Many have been purchased by individual departments, the remainder being for general use. Most of the general use Xterminals are located on the Ground Floor outside Second Year Lab and on the First Floor outside Third Year Lab. If you find that it is difficult to get access to an Xterminal, then consider lobbying an academic in your Department to write a grant application to buy one.

Using an Xterminal

Xterminals are diskless terminals designed to connect to UNIX workstations and provide an Xwindows interface. In general if they are used properly they will rarely cause much trouble. Here are some guidelines to follow when using Xterminals:

Fixing a stuck Xterminal

It is important not to reach for the off-switch as a first attempt to fix a recalcitrant Xterminal. This is because the workstation expects the Xterminal to be in a particular state, and if you turn the terminal off and then on, the state has been lost. The workstation may be waiting for input from a window that no longer exists.

Start by looking for the tell-tale flashing (once a second or more) of an LED on the keyboard (note: ths applies to the NCD Xterminals only--other Xterminals have an internal LED). The LED flashes each time that the Xterminal is sent data on the ethernet. If the LED is not flashing then either

The final problem needs further explanation. When you first turn on an Xterminal it knows nothing about how to interpret the X protocol (which is what the workstation speaks to it), all it knows is how to establish a simple connection to a remote server for the purposes of downloading its own operating system. The Xterminal performs the following steps immediately after it is switched on:
  1. Checks its internal memory. If there are problems at this stage an error message will appear, and you should e-mail (in your e-mail be sure to quote the number on the front of the Xterminal).
  2. Broadcasts a message on the ethernet asking someone to tell the Xterminal what its ethernet address is. magellan should respond. If the terminal can not find its address, then either the ethernet is faulty, or magellan is down.
  3. Downloads its operating system. This process is indicated by a series of dots appearing on the screen (NCD Xterminals only). The dots should appear rapidly and at a uniform rate (with maybe one or two pauses) for about 1.5 screen widths (more for a colour Xterminal), taking a total time of 10 seconds or so. If the dots appear slowly, and with many hesitations of five seconds in length, then there is probably an ethernet problem, most likely due to electrical noise from a piece of lab equipment, or to someone having over-extended or incorrectly terminated the segment of ethernet that you are on (try looking at the back of the Xterminal, if the ethernet is not connected via a tee-piece directly to the terminal, then a wiring error has been made). You should track down the source of the problem, otherwise your Xterminal performance will be degraded.
  4. The Xterminal now downloads a configuration file that sets numerous internal parameters.
  5. A few fonts are now loaded. During this step and the preceeding one, the Xterminal displays on the screen what it is doing. If there are any errors in loading fonts you should turn off the Xterminal and start again. After the fonts have loaded, the Xterminal's screen shows a uniform grey pattern and is ready to accept X-protocol commands.

What happens next depends on the state that the workstation thinks the Xterminal is in. If the workstation thinks that you have a login session underway, then it is possible that nothing will appear on the screen. If the Xterminal had been logged out of correctly before it was last turned off, then the workstation will realize (after a short delay, less than one minute) that the Xterminal is now available again, and will display a login box (generated by a program called xdm). If the terminal still displays a blank grey screen, try the following

It may also be useful to have a look in the DIAGNOSTIC SESSION window accessible from the COMPOSE-SETUP menu (note that COMPOSE-SETUP only works with NCD Xterminals, and only after you have booted the Xterminal from the workstation. Normally this window will display information concerning the fonts that the terminal has loaded. If strange error messages appear, they may give you a clue as to the problem. Also, try looking at NETWORK STATISTICS, and examine the number of ethernet errors such as collisions as a fraction of the total number of ethernet packets received/transmitted. The fraction should be very small, perhaps 0.01%. If it is high, it usually points to a problem with noise on the ethernet. You can select a button to clear the current statistics in order to compare the current error rate with the long term average.

Barely legible fonts

When using Xterminals with small physical screen sizes it may be hard to read some Web documents with Netscape because of miniscule fonts. Here are the suggested settings to ensure fonts are readable even on smaller screens:

Edit -> Preferences -> Appearance>Fonts
Variable Width Font: Times (Adobe)      Size: 14.0
                                        < > Allow Scaling
Fixed Width Font:    Courier (Adobe)    Size: 14.0
                                        < > Allow Scaling
<X> use my default fonts, overriding document-specified fonts


The plotting packages currently available on the workstations are xmgr, sm (written by two astronomers, Robert Lupton and Patricia Monger), gnuplot (the GNU project's excellent package), pgplot (a nice package of Fortran callable routines written at Caltech), and Mathematica.

xmgr is excellent for publication quality graphs, and has GUI that makes it easy to use. Documentation for it is available via xmosaic or netscape.

sm is command-line driven, and has advantages and disadvantages with respect to xmgr. It supports a number of different graphics devices. If you have an Xterminal, try the following

sm                              ! this starts up sm
Hello Michael, please give me a command
: device x11                    ! select x11 mode           
: box                           ! draw a box on the screen
If you don't have an Xterminal, and do have Tektronix emulating software, then you can use device tek4010 instead of device x11.

Here is a more complex example, directing output to a laser printer (either p206 or the printer defined in the environment variable PRINTER).

sm                              ! this starts up sm
Hello Michael, please give me a command
: device postscript             ! select the Laser printer
: set x = 0, 3.14159, 0.01      ! create an array of x values
: set y = sin(x)                ! find the sine of each x number
: limits x y                    ! choose the limits for the axes
: connect x y                   ! join the dots
: box                           ! plot axes and tick marks
: xlabel angle in radians       ! label the x-axis
: ylabel sin(angle)             ! label the y-axis
: device 0                      ! close the plotfile and send to the printer
: quit                          ! leave SuperMongo
sm is a highly flexible and interactive plotting environment. You can call the sm graphics routines from Fortran or C programs. Some documentation is on-line in man sm, and all the commands are described in detail within sm itself (try help within sm). There is also an extensive manual written in TEX and available for photocopying from Michael Ashley.

Text processing


OpenOffice is the generally more available and redistributable version of Sun Microsystem's ``StarOffice'' suite. It is reasonably compatible with certain other commercial ``Electronic Office'' products. OpenOffice includes in addition to wordprocessing these components: spreadsheets, presentations, personal information management, and Web authoring. You can access OpenOffice from the KDE or Gnome menus, else enter ``openoffice'' at a UNIX command prompt. Use the Help pull-down menu to access the OpenOffice help pages.

TEX and LATEX typesetting

Besides OpenOffice, the only `wordprocessing' program on the workstations is TEX (LATEX is simply TEX with an extra macro package: it is available also). TEX is not really a wordprocessor, it is a typesetting program. It is specifically geared towards scientific and mathematical typesetting of the highest quality. Note that TEX is not a WYSIWYG (What You See Is What You Get) program.

Incidentally, the word TEX is usually pronounced ``teck'' (although for the truely correct pronounciation, see Donald Knuth's ``TEXbook'') and LATEX something like ``lay-teck'' or ``lah-teck''.

To use TEX you first create a file containing your text and associated TEX commands. This file is normal ASCII text, can be created using any text editor, and can be e-mailed around the world and transferred between computer systems without fear of being corrupted by communications software (unlike the output from most PC-based wordprocessors which use full 8-bit binary input files). Once you have the input file, you run TEX, or LATEX, on it and correct any errors that appear. The error messages from TEX can be very hard to understand. The best approach is usually to note the line number of the error and then visit that line with your text editor and look for something obviously wrong. With practice you can find errors very quickly.

TEX produces a file with an extension .dvi, which stands for ``device independent output''. If you have an X-terminal you can use xdvi to preview the results before printing. To print the file you must first feed it into dvips to convert it into PostScript, which the laser printer can understand. You also view the output of dvips on an Xterminal using GhostScript (gs), which can be preferable to using xdvi, particularly if your document incorporates PostScript graphs.

Here is a complete example of the steps required

emacs                                   ! enter emacs for editing
C-x C-f myfile.tex<CR>                  ! ^x^f to open a file
{ enter your text at this point }        
C-x s                                   ! save the file
C-z                                     ! exit emacs 
                                        !  (keeping it in the background)
latex myfile                            ! run LaTeX on your file
xdvi myfile&                            ! preview output (X-terminal only)
dvips myfile                            ! convert to PostScript
lpr                           ! print the PostScript file
                                        !      NOTE THE .PS EXTENSION!
%emacs                                  ! go back and try again!
dvips has a number of useful switches available, for example,
dvips -n2 -p35 myfile
will print two pages beginning at page number 35. Please use these options wisely to avoid the excessive use of the printer. dvips is a locally added command and is documented in man dvips. Note that dvips will automatically make fonts using MetaFont if they are not present on the workstation (provided that the appropriate font metric file is found in /usr/local/tex/fonts/tfm). You should not use this as a way of generating documents at arbitrary font scalings (e.g. 0.97% of normal size), however, since the generation of new fonts is very cpu intensive.

Using ``emacs'' to write LATEX documents

The emacs editor has features that make it easy to compile and preview documents while you're editing. Tabled below are some useful keystrokes. The key sequence C-c C-f means ``Hold down the Ctrl key while you tap C followed by F''.

Key sequence Description
C-c C-f Compile the buffer contents using LATEX
C-c C-v Preview the buffer contents with xdvi

Using ``vim'' to write LATEX documentswriting

The vim editor can be useful for working with LATEX documents once you have enticed it with particular commands. If you're not familar even with vi, you might like to give this section a miss (or see the discussion on editors in §[*]).

Command Description
:syn on Turn on Syntax highlighting
:compiler tex Use LATEXfor compilation
:make file Compile the document called ``file''

Use the name of your LATEX file when you use vim's make command tabled above. For example, if you're editing the file chap9.tex you could compile the document using :make chap9--this is the equivalent of typing latex chap9 at a shell prompt.

If you use vim in this mode frequently then you might like to create a file in your home directory called .vimrc. Place the LATEX mode commands in the .vimrc file:

syn on
compiler tex

Turning off page numbering

If page numbering is undesirable for a particular project (for example, you're making single sheet posters) try the following command to suppress page numbers:


Landscape printing

You may use the lscape package for landscape printing. Note, however, that you must also use switches to dvips and xdvi to handle printing and previewing (see the next section). To use lscape follow this example,

% Swap to landscape orientation
% A wholesome pagenumber snack suppresses page numbering
This is a landscape test.

The commands to have dvips and xdvi handle landscape documents are tabled here,

Command Description
dvips -t a4 -t landscape file Generate Landscape PostScript output
xdvi -paper a4r file View rotated (Landscape) preview

The above commands may produce results that are less than pleasing, so you might be better off using pdflatex and previewing or printing the document with xpdf or acroread. For example,

pdflatex poster
acroread poster.pdf
xpdf poster.pdf

If somehow you then yearn for a PostScript version of the PDF file (which does correctly preview with ghostview), try

cat poster.pdf | acroread -toPostScript >


If you have access to a colour printer (refer §[*] or to the file /etc/printcap for a list of colour printers in the School) you can use the color package to set different text colours. As per fonts variations, colour variations in text should be used sparingly to avoid making your output look gaudy or hard to read.

% Define a colour (optional)
% Print black text, except the word 'colour', which prints in red
This is a \textcolor{Red}{colour} test.

Note that you will not see a colour preview when you preview the document with xdvi. To see colour, preview the document with ghostview after converting it to PostScript with dvips. You can also preview the document in colour with xpdf or acroread after converting it to PDF with pdflatex.

A3 printing

You can create a document in LATEX suitable for printing on A3 paper with the vmargin package.

% \setmarginsrb{leftmargin}{topmargin}{rightmargin}{bottommargin}%
%              {headheight}{headsep}{footheight}{footskip}
\noindent Left

After compiling your document, generate an A3 PostScript file using
{\tt dvips -t a3 {\it file}}. You can preview the document using
{\tt xdvi -paper a3 {\it file}}.

\subsubsection{Typesetting mathematics}

When you first start using \TeX\ you may find it difficult. If you need
to use mathematics in your papers \TeX\ is almost the only way of making
it look right, however. This document was typeset using \LaTeX, and here
is an example of some mathematics:

$$\pi=\int_{-\infty}^{+\infty}\sin x\,dx$$

which was typeset using the following line in the input file:
$$\pi=\int_{-\infty}^{+\infty}\sin x\,dx$$
This may look complex, but it has a certain logic to it. (Note that TEX won't check the correctness of your equations). As another example,


was typeset with

Notice how TEX took care of choosing the right sizes and positions for the square-root symbols. If you carefully compare the output from these examples with that from PC-based word-processors you will notice the superior typesetting quality that is available with TEX.

mathematica can produce output in TEX form.

PostScript graphs, diagrams, and images can easily be incorporated into TEX documents. See man dvips for details.

Rather than using the normal TEX fonts, it is possible to use the Adobe PostScript fonts that are built into the laser printers. This has several advantages: (1) the Adobe fonts are generally nicer looking, particularly at small font sizes, (2) you can select arbitary point sizes without the need to run metafont, (3) the .dvi files are much smaller since the font bitmaps do not have to be sent. The disadvantage is that some of the more esoteric TEX symbols don't work correctly in PostScript. To try using PostScript fonts in a LATEX document, put the argument times in the option list for the documentstyle command, e.g.

To use an individual font in a TEX or LATEX document, do something along these lines

\font\myfont=ptmr at 72pt

which will define the token myfont to mean the PostScript Times Roman font at 72pt (25.4 mm high). To obtain a list of the available fonts, have a browse around /usr/local/lib/tex/fonts.

The Optima font and UNSW letterhead samples

The Physics workstations support the Optima font. Optima is somewhat of a standard for typesetting at the University of New South Wales. To use Optima in your LATEX documents you can do something like this:


The first command sets the sans serif font to Optima, then switches the active font to sans serif.

The School of Mathematics also kindly provided some basic templates for letter, memorandum, and facsimile documents. Samples for these can be found on the Physics workstations in the directory


Copy the desired sample to your LATEX work directory, edit as required, compile, preview, and print the document in the usual manner; no special steps are required to use these samples on the Physics workstations.

Indentifying references in your document

There is a public domain program called getref available which will search through a TEX document (or, in fact, any ASCII text file) and try and identify any references to the literature that you have made. This is useful for checking that the list of references in a paper matches those that you have actually referred to in the text. To use it, try

getref < inputfile > outputfile


getref < inputfile $\vert$ less


There are many different mail programs available, e.g. ucb mail, mh, pine, elm, mush, plum, dxmail, dtmail. Each of these `mailers' has different features, and not all of them are compatible. In particular, if you use dxmail it will move you mail messages into `folders', which may then make them difficult to access using other mailers--on the newer machines running Tru64 UNIX there is a utility, mailcv which can aid conversion of mail stored in the strange dtmail format to a more conventional mailbox format, see man mailcv regarding its use.

A simple mail program to practice with is mush (which stands for `Mail User's Shell'. Enter the mail program by typing


To send mail to a user, use

mush> m
Subject: Cold fusion
Dear Fred,

 I was interested to hear of your experiments with cold fusion 
 in high temperature superconductors...
send, edit, delete?> s
Note the use of Ctrl-D to exit and send the message. Type Ctrl-C twice to abort sending a message. At the mush> prompt you can type ? to get a list of available commands, h to get a list of all the messages you have received, q to quit.

To send mail to users on the same workstation you don't need to give the computer name, just the username. To send a file to another user, use input redirection, i.e.

mush -s "Here is the program you asked for" fred $<$ test.f

Here is a similar example using pine, which is another highly recommended e-mail program. Start the program by entering at the UNIX prompt,


If this is the first time you have used pine you will see a welcome screen providing some general help. At the bottom of the screen will be a prompt for receiving a pine information document or somesuch--respond in the negative since doing otherwise won't help you much.

To send mail to a user, press c in the main menu to begin composing a message. Fill in the fields of the compose message screen as required. For example,

To      :
Cc      : 
Subject : Hapalemur
----- Message Text -----
Dear Pat...

Congratulations on your discovery of hapalemur griseus in the
submontane rainforest near Ranomafana!

Note the use of Ctrl-X to send the message and exit the compose message screen. You can use Ctrl-C to cancel the message--in both cases you will receive a confirmation prompt.

From most pine menus you can press ? to display context sensitive help. Since pine relies heavily on menus, most of the basic operation is self-evident.

As noted in the section on security, it is wise not to assume that e-mail is a secure form of communication (it isn't). Messages that you send may be distributed by the recipient to other people without your permission. Also, it is possible for malicious users to send mail that appears to originate from someone else.

Brief comments on the choice of mail programs

The basic UNIX mail interface, quite OK for day-to-day use if you are a command line interface (CLI) enthusiast.
Very easy to use, menu-driven, packed with features. Highly recommended.
A sophisticated X interface to the mail system. It has lots of nice features and is easy to use. It requires an Xterminal, and is only available on DEC workstations (and is therefore not recommended).
A collection of e-mail tools.

Extracting and printing mail messages

To extract a copy of a mail message on a laser printer, do the following from within mush

s num file

where s stands for save, num is the number of the message that you want to print (you can specify a range of numbers, e.g. 20-23, or leave num off altogether if you want to extract a message that you have just read), and file is the name of a file that you want to store the message in. If you want to print the file you have just extracted, you can do it as a ``shell escape'' from within mush, e.g.

!a2ps file$\vert$lpr

and your message will appear on the laser printer in due course.

To print from PINE highlight the message from the folder list and then press y. Select from the list of printers (use Ctrl+P or Ctrl+N to choose a printer other than the default) and then press Enter to send your message to the selected printer.

e-mail addresses

e-mail addresses are usually of the form user@node.domain, where user is the user's login name, node is the local name for the computer (e.g. newt), and domain gives the institution and country (e.g. Some typical e-mail addresses are:
Usually the easiest way of finding someone's address is to ask them to mail you a message, and then examine the header.

A good way of checking to see if a particular machine exists is to use nslookup:

which will return an IP number for the machine if it exists and is reachable on the internet (this won't work for bitnet machines, or other networks that are not directly connected to the internet). nslookup can also be used to find the name of a machine if you know its IP number. Often e-mail addresses do not directly refer to a machine. A good example is where there is no machine actually called This is achieved using special name server records (called MX or Mail Exchanger records) that mail routing software considers when attempting to deliver e-mail. In such cases you can check which machine handles a particular e-mail address using dig:
dig mx
which will return a workstation or workstations in its "ANSWER SECTION" if the lookup was successful.

To check if a particular user exists on a machine, try

finger user@machine.domain
which will also tell you when the person last logged in, and, possibly, when he/she last read mail. Note that many sites may not respond to such finger requests due to restrictions imposed by their local administration.

To get a list of all the users currently logged on to a particular machine, try

finger @machine.domain

Some details of how mail works

Mail is delivered by a package called a mail transport agent (MTA) which runs on the system. Incoming mail is placed in a `spool area' by sendmail, specifically in a file called /var/spool/mail/user where user is the username for which the mail is directed. Incoming mail is placed by qmail in the file Mailbox in your home directory. Some mail programs will move mail from the spool file into a subdirectory called Mail or mail within your home directory; other mailers will tend to leave the mail in the spool file unless you specifically ask for it to be moved.

Advanced use of mailers

Most of the mailers listed in the introduction can be programmed to perform exceedingly tricky tasks. For example, it is possible to automatically sort your incoming mail into folders on the basis of who it came from, or a line in the subject heading. You can automatically forward mail to multiple addresses, automatically reply to mail to indicate that you have received it, and automatically append a `signature' (usually your name and contact information) to any outgoing mail that you send. In fact, you can perform any imaginable task by writing scripts in your mailer's programming language. The stand alone package procmail is very userful for filtering junk e-mail and sorting legitimate mail, while the vacation package can be used to set up automatic replies while you are holidaying.

Accessing remote mail servers

It is possible to configure e-mail clients (for example, PINE or Mozilla Mail) on the Physics workstations to read mail from a remote server. For example, you may configure PINE to read its mail from a mail server that supports the IMAP protocol by editing this line in your .pinerc file:


If PINE has been compiled with SSL support you may use a variation of the above to tell it to more securely access remote mail. To tell pine that your mail lives in the z0000000 account at and that SSL should be used for the connection, edit this line in your .pinerc file:


School mail lists

There are several mailing lists or ``exploders'' available within the School for use when e-mail needs to be distributed to specific groups of recipients. For details regarding the lists and their appropriate use visit

How to join School of Physics mail lists

Send an e-mail (including the list(s) you wish to join) to Physics IT Support staff will send you a reply e-mail to advise when you have been added to the list(s)--this usually takes an hour or two at most.

Majordomo lists at UNSW

This information was extracted from

UNSW maintains a majordomo style series of mailing lists. You can send various commands to majordomo by sending e-mail to it at Majordomo@explode.unsw.EDU.AU with the line. Note that this is the address of the majordomo robot, not the e-mail address of the mailing list (see below). You need not put in any subject line as it ignores this, but on each line of the main body of the message you can enter the following commands:

request a list via e-mail of mailing list names available at UNSW.
info listname
request information via e-mail about a specific list name
who listname
request a list of the e-mail addresses subscribed to a particular mailing list
subscribe listname
request to be subscribed to a mailing list (don't leave in the braces!)
unsubscribe listname
request to be unsubscribed from a particular list (don't leave in the braces!)
end of commands; this is useful if you have a signature appended to the end of your message as it stops majordomo trying to understand what your signature means!

Below are examples of Majordomo commands. These examples show a PINE mail client compose screen but the basic idea should be obvious to users of other mail clients.

Example: subscribe to a list

To      : Majordomo@explode.unsw.EDU.AU
Cc      : 
Subject : 
----- Message Text -----
subscribe tidbits-list

This will subscribe you to the fictitious 'tidbits-list' mailing list; substitute the name of the list you wish to join in place of tidbits-list. Majordomo will automatically pick up your e-mail address. Note that you should receive the information about the list as confirmation of your acceptance.

Example: unsubscribe from a list

To      : Majordomo@explode.unsw.EDU.AU
Cc      : 
Subject :
----- Message Text -----
unsubscribe tidbits-list

This will unsubscribe you from a particular mailing list.


USENET is an international collection of several thousand ``electronic conferences''. To subscribe to newsgroups and to read them, use the rn (for ``readnews'') command, after first using newsetup. An alternative way of reading newsgroups is to use tin (a menu-driven, character-based news reader), or the dxrn command, which gives you a nice X11 interface to the news reader (and therefore only works from an Xterminal). The available newsgroups range from alt.alien.visitors through bionet.molbio.genbank.updates,, and so on. This may sound like a waste of time, but it is surprising how much useful information can be obtained through SENET. For example, if you want the latest information on the observing chedule of the Hubble Space Telescope, then look in sci.astro. Also, USENET acts as a distribution channel for public domain software, much of which is very good. Use the command newsgroups to get a complete list of all the available newsgroups.


PINET is the Physics Information Network supported by the American Institute of Physics. It can be conveniently accessed from the Physics workstations through the Internet. There are no communication charges and the connect charges are fairly nominal.

PINET provides comprehensive databases and information services in Physics and Astronomy. These include:

The service has a one time registration fee of $US15, with connect charges ranging from $US10-$19, depending on the time of day, for members of one of the AIP's Member or Affiliated Societies, and $US29-$12.50 for non-members. Payment can be made by Credit Card.

You can access PINET's information menu along with an online registration form as follows (there is no charge for this):

Login to newt.phys
Type: telnet $<$CR$>$.
Do not press any key until the login: prompt (up to 30 secs delay).
Type: new $<$CR$>$.
This will bring up the introductory menu which is self-explanatory.
The menu has a quit option when you are finished.

Further information from David Neilson.

World Wide Web

The World Wide Web (or ``the Web'') is comprised of computers throughout the world which serve information on the Internet using the ``hyper-text transport protocol'' (HTTP). Due to the enormous amount of information on the Web it can be an indispensable research tool. To make use of the Web you need a ``browser'' such as Netscape or Internet Explorer. Netscape is available on most UNIX workstations in the School. To get started, at the UNIX shell prompt enter


If you are logged in to the Physics workstations from a text environment via telnet or rlogin, netscape will not be available. You can still browse the Web, but you must instead use a text-based browser such as lynx. See the lynx man page for further information.

Search Engines

Finding what you want on the Web often depends on effective use of search engines. Search engines let you find what you want by sifting through portions of the immense volume of information on the Web. It is recommended to use several different search engines since one search engine may find what you want whilst another does not. Some common search engines are:

Web pages on the Physics workstations

You may set up your own Web page on newt and ugrad for others to access via the Internet. When you create Web pages on University machines there are some important guidelines imposed by the University regarding content and style which you should follow. Please note that it is unacceptable to use University computing facilities and Internet access to endorse a commercial product or service. For guidance please visit the UNSW Web Standards site at

Files and directories

The Web server must be able to descend into particular directories and read certain files in order for your Web page to be accessible from the Internet. In your home directory, there must be a directory named "public_html", and optionally inside that directory there may be a file named "index.html". The index.html file is a Web document which will be displayed if the Web browser target is a directory instead of a file--you can think of an index file as a ``start-up page''. The suggested permissions are as follows:

drwx-----x   ~/				! Your home directory
drwx-----x   ~/public_html/		! Web directories
-rw----r--   ~/public_html/index.html	! Web documents

The command to effect the directory permissions above is:

chmod o+x ~ ~/public_html

Before you start working on your Web page you can use the umask command to set default permissions on newly created files and directories-this simply saves you from having to set the directory and file permissions later with the UNIX chmod command. To use the permissions suggested above:

umask 072

When you finish working on your Web page you can reset the umask to its default value as follows:

umask 077

Your Web address

In order for people to get to your page they have to know which Web address to point their browser at. For ugrad your address will be:

For newt, the School's primary Web server, it will be:

Restricting access to Web pages

You may restrict access to certain users, groups of users, or to network domains by placing specially named files in your Web directory or subdirectories therein.

Password access

Below is an example of how to protect a directory called priv with a password. In this example, only users in the group ``collaborators'' will be given the opportunity to ``login'' to the protected Web page. The directory which you need to protect should have the same permissions as regular Web document directories:

drwx-----x   priv

The files should have the same permissions as those of regular Web document files:

-rw----r--   .htaccess
-rw----r--   .htgroup
-rw----r--   .htpasswd
-rw----r--   index.html

Here is an example of the contents of .htaccess that will only permit users sifaka, indri, and aye-aye to log in with passwords,

AuthUserFile  /users/primate/lemur/public_html/priv/.htpasswd
AuthGroupFile /users/primate/lemur/public_html/priv/.htgroup
AuthName Restricted
AuthType Basic 

<Limit GET>
        require group lemurs

For our example the contents of .htgroup would be as follows,

lemurs: sifaka indri aye-aye

You need to create .htpasswd using the htpasswd command. Initially you should use the -c switch to create the .htpasswd file and add the first user. To complete our example, the command below will create a new .htpasswd file and add the user sifaka with an interactively specified password,

newt:~/public_html/priv> htpasswd -c .htpasswd sifaka
New password:

Subsequent users can be added to an already populated .htpasswd file by omitting the -c switch. Existing users' passwords can be changed in the same way.

The only required file name is .htaccess. The other file names are simply those set by the AuthUserFile and AuthGroupFile tags in .htaccess. It is recommended that you use the same file names as those in the above example because the Web server prevents people from downloading or viewing files with those filenames.

Domain access

You may limit access to your pages to selected domains or IP networks. Below is an example contents of the .htaccess file that will restrict access to the domains and IP networks specified by the the allow tags,

(umask 072 ; cat >~/public_html/.htaccess)
AuthName "restricted goodies"
AuthType Basic
order deny,allow
deny from all
allow from
allow from 129.94.163.
allow from 129.94.162.
allow from 129.94.149.

To cut and paste this example, enter the first line which is in parentheses, paste the lines up until ^/D, and then press Ctrl-D.

Permissions and security on the local workstations

A brief comment on the security of Web documents. The permissions for directories and files required by the Web server also leave your Web documents readable by anyone with an account on the workstation running the Web server. Avoid setting "read" permission for ``Others'' on public_html and its subdirectories to dissuade people on the system from wandering about in your protected subdirectories. It is also a good idea to keep links and references to protected documents from unprotected documents to a minimum--this reduces the chance that someone on the system will be able to know exactly where to look for a protected document file in your public_html directory by viewing its link inside an unprotected document.

Encryption and authentication

The Web server on newt supports encryption of information traveling between the server and a Web browser. If you are concerned about people intercepting your protected page usernames and passwords as they are sent to the Web server, you may tell users of your protected documents to prefix the newt Web address with "https://" instead of "http://". This will instruct the Web browser to use an encrypted channel when communicating with newt.

As of this writing, newt does not provide authentication. Web servers like the one on newt typically use "certificates" which are cryptographically signed by a separate trusted authority-this is the basis of authentication. Since the certificates issued by newt are self-signed, clients have only Newt's assurance that they are actually talking to Newt and not an imposter. Encryption is less safe without authentication.


UNIX makes it easy to cause catastrophic damage to your files, e.g.

rm -f *

will delete all the files in the current directory. The typo

rm -f data. *

when you meant to say

rm -f data.*

will try and delete the file data. and then proceed to delete all the files in your directory.

Once files are deleted they are not retrievable. There is no undelete utility as in MS-DOS, and there are no version numbers to protect you as in VMS.

A common way of deleting files accidently is to simply move a file on top of an existing file, for example,

mv junk.txt precious.tex

will irrevocably overwrite precious.tex.

Simply copying a file onto itself can also destroy a file. It is possible to prevent this behaviour (and the destructive behaviour of mv) by setting the environment variable noclobber, see man csh for details.

The tar utility is also dangerous. Using the wrong option can be a disaster. Read the manual carefully.

Using a modem and the University Dial-Up Service (UDUS)

The University Dial-Up Service (UDUS) provides connection to the Internet over telephone lines and thus allows users at home to run applications such as telnet, ftp and netscape directly from a personal computer. To find out more about the UDUS service, telephone the DIS$><$Connect Helpdesk on 9385 1777 or visit the UDUS Web page at

How to login from an Xterminal

To log in from an Xterminal, use the mouse and double click the host you wish to connect to. If there is no host menu on the Xterminal screen refer to §[*] for help on making one appear.

Logging out

Select the windows manager's Logout option via its desktop button or root (floating) window. Access the root menu by left-clicking (IceWM) or right-clicking (KDE) with the mouse point positiotn in an unoccupied area of the desktop.

How to login and transfer files with SSH

Logging in

Login from a UNIX computer

Secure shell, or ssh, is a replacement for rlogin, rsh, and rcp. It provides secure encrypted channels of communication between trusted hosts on possibly insecure networks. Where possible, it is recommended that you use secure shell instead of telnet or 'r' commands such as rlogin. Both the local and remote hosts must support ssh for the secure communication to be possible. To login to a host with slogin:


Run a command remotely

To run a command on a remote host with ssh:

ssh -f /usr/bin/X11/xterm -ls

The above command will start xterm (-ls means ``make the session a login shell) from Jill's account on ugrad and display it on the local terminal.

Using scp to transfer data

The scp command is part of the ssh package and can be used to copy files to and from the Physics workstations, e.g.,

scp .

With scp entire directory hierarchies may be copied with permissions retained, e.g.,

scp -rp .

The above command would create a directory called thesis containing all files and directories in  /tex/thesis on Use man ssh and man scp for more information.

Warning: Host identification has changed

Under certain circumstances a host's public key might change for a legitimate reason and you may get a warning similar to this when you try to connect:


It is a good idea to e-mail or the remote host's administrators (try postmaster at the remote host) to verify that it is safe to log in to the host. If it is safe then remove the stale public host key to get rid of the warning message (replace ugrad with the name of the host you are trying to connect to):

mv ~/.ssh/known_hosts ~/.ssh/known_hosts.orig
grep -v "ugrad" ~/.ssh/known_hosts.orig >~/.ssh/known_hosts

Logging out

Type control-D. That is, hold down the control key, and press the ``D'' key at the same time. You can also simply type logout (it is possible to disable the effect of control-D if you don't like having a control character that logs you out, see man tcsh for details). Sometimes when you do this you will get the message ``you have stopped jobs''. This means that you have jobs in the background (put there by using ``&'' or by typing control-Z) which have halted for some reason (usually waiting for terminal input). You can ignore this warning and type control-D again, which will log you out and delete the stopped jobs. Otherwise, use the jobs command to find out what the jobs are, and use %n to reconnect to any which you want to continue. Note that deleting a stopped editing job may result in losing any files that you have not saved.

SSH clients for other platforms

Secure Shell clients for Windows and MacOS can be found here:

If you are using Apple MacOS X (the ``X'' is pronounced ``ten'') you already have OpenSSH; open a terminal and enter at the UNIX prompt ``ssh ugrad'' to login to ugrad.

More information

A guide to installing SSH clients on various operating systems can be found here:

The primary SSH address on the World Wide Web is

Terminal management using ``screen''

The screen program is effectively a window manager for character terminals. With screen it is possible to start multiple character terminals from a single login character window, and then: flip between each terminal, detatch the entire terminal session without affecting applications running in each terminal, login later from elsewhere and reattach the terminal.

screen uses a hotkey (C-a by default) followed by one or more keys to perform the desired function. For example, to create a new window you use C-a c which means ``hold down Ctrl while you tap A followed by C''. You don't have to hold down Ctrl after you've pressed A but it make for a more fluid gesture that feels comfortable after you've used screen for a while.

Here is an example of how to use screen to start three seperate character terminals: a vim editor session, a login shell, and a numerically intensive job called that happens to be named a.out. After you login,

screen         ! Start 'screen'; press Enter to clear welcome text
vim chap8.tex  ! Start editing file 'chap8.tex'
C-a c          ! Create a new terminal; you get a new login shell
ls             ! Do something
C-a c          ! Create another new terminal
./a.out        ! Start a long-running job
C-a space      ! Switch to the next terminal; you return to 'vim'
C-a d          ! Screen detaches---your terminals are unharmed

You can then logout. When you log back in (from, say, home) you can do the following to resume screen:

screen -r      ! Reattach 'screen'; you return to 'vim'
C-a space      ! Switch to next terminal; you see your 'ls' output
C-a space      ! Switch to next terminal; you see your 'a.out' output
C-a k          ! Your a.out job locked up! How sad. You kill the terminal
               ! and you are moved to the next terminal, 'vim'
C-a backspace  ! Switch to previous terminal; you see your 'ls' output

When you've finished using screen, quit your terminal applications and enter logout (or press Ctrl+D) until you see the message [screen is terminating]. See ``man screen'' for a list of all the options that screen supports.

Transferring files with ``rsync''

rsync provides potentially fast local or remote incremental data transfers. It is fast because rsync can synchronise data by copying only the differences between source and target data. rsync can use Secure Shell (SSH) to improve security by encrypting the session. On newer FreeBSD workstations rsync defaults to SSH where as other operating systems such as Linux may not (in which case it is necessary to add the -e ssh switch).

Rsync must be installed on both the source and destination computers. All of the main Physics workstations include rsync. If you need to install the program on your local workstation you will find most major Linux distributions such as Debian and Redhat have packages available. Else, visit the Rsync home page to download the source:

Below is an example of how to make the contents of  /mirror/project on a workstation the same as the contents of  /project in Jack's newt account:

rsync -n --delete -av jack@newt:~/project ~/mirror

IMPORTANT! The -delete command is extremely dangerous and should be used with care, since it makes the source and destination identical, even if it means deleting data in the destination directory. Use the -n switch (``dry run'') to simulate the rsync transfer beforehand.

Compiling programs

Programming languages available

The following programming languages are available: Fortran (f77, F90 and F95), C, gcc (GNU C compiler), perl (replacement for sed and awk), as (assembler), p2c (a Pascal to C converter), f2c (a Fortran to C converter), PHP.

Reference information regarding the Fortran compilers available on the Physics workstations running HP Tru64 UNIX can be found on the World Wide Web. For f77 refer to


For F90 and F95 refer to

FreeBSD and Linux workstations in the School provide in addition to GNU Fortran (``f77'') the Intel Fortran compilter (``ifc''). Here is a quick list of commands to help you get started using IFC on the Physics workstations:

Command Description
ifc -help |most Show compiler options 'more' pager
ifc -c -o veloc.o veloc.f Compile the program in file 'veloc.f'
ifc -c -w90 -o proj.o proj.f Suppress warnings regarding non-standard Fortran
ifc -c -w90 -o proj.o -g proj.f As above but include debugging information

See ``man ifc'' for a list of all the options that ifc supports. The Intel(R) Fortran Compiler for Linux support site may also be worth a visit:


Fortran source files must end with the characters ``.f''. To compile and link a Fortran program you use

f77 prog.f

The above command will place the executable binary file in the file a.out. To run the program, type


If there were any errors in the compilation, the file a.out may still be created, but will not have execute permission, so you can't run it. (If you really want to try running it, use chmod (see §[*]) to change the file permissions). To rename the output file, either use the mv command, or use the -o switch on the f77 command, e.g.

f77 prog.f -o prog

To compile a subroutine module without linking, use

f77 -c sub.f

which generates an object file called sub.o, which you can then link with the main program prog.f by using

f77 prog.f sub.o

A better way of compiling programs that consist of numerous subroutines in separate files is to use the UNIX make command. make is an ingenious program that takes a set of rules (stored in a file called Makefile) and uses them to build something. An example should make things clearer. Suppose that you have a program called prog with a main routine in prog.f and subroutines in f1.f, f2.f, and f3.f, then place the following text in Makefile with your favourite editor

prog:   prog.o f1.o f2.o f3.o
        f77 prog.o f1.o f2.o f3.o -o prog
Note: the blank space after prog:, and before f77 is a tab character, not multiple ASCII space characters. This is essential. The first line of the Makefile tells make that the target prog depends on the files prog.o, f1.o, f2.o, and f3.o. The second line tells make how to construct prog from these files. So if you type make your program will be compiled using these rules. The clever bit is that if you make a change to one of the input files, say f2.f, then when you type make again only f2.f will be recompiled to construct prog. make achieves this by looking at the modification times of the files, and only recompiling those files that have been modified since the creation of the associated object file.

Recommendation: when writing a new program, create a new directory for it, place all the relevant files there, and write a Makefile to handle the compilation. This will save you a lot of typing and reduce the number of unnecessary compilations.

Note that make is considerably more powerful than the above example would suggest. Unfortunately, the man documentation is probably the most opaque of any ever written, so your best way of learning how to use it is to examine other people's Makefiles, and a good place to do that is in the /usr/local/src or /usr/ports directory trees.

Debugging Fortran programs

Tru64 UNIX workstations come with an excellent debugging program, called dbx. To use it you must have compiled your program with the -g -O0 switches, and it is probably also a good idea to use -check_bounds as well. For example,

f77 -g -O0 -check_bounds prog.f -o prog

You then run the program by entering

dbx prog

At this point you will be positioned at the first executable line of the program, and you can type ``r'' (for ``run'') to start the program. Using dbx you can set breakpoints (stop at 314, stop in mysub), examine variables (p myarray), step one line at a time (s), continue to the next breakpoint (c), find where the program has stopped (where), examine the source code at the current point (list), and so on (use help within dbx, or see the man pages, for more information). It is well worth spending the time learning how to use the debugger.

Note that when you have finished debugging your program, you should recompile the production version without the -g -O0 -check_bounds options, since otherwise you will be paying a large penalty in execution time.

Linux and FreeBSD systems come with the GNU Debugger, GDB. Although it is mainly designed for C gdb is also useful for debugging Fortran code. You must have compiled your program using -g -O0. Debug your program by entering

gdb prog

Several handy gdb commands are:

Command Description
list Show program listing
run Run the program
backtrace Show stack track--useful for spotting problems after a segfault
break n Set a breakpoint at n
help List available command classes

See ``man gdb'' for a list of all the options that gdb supports. Some workstations also have a graphical frontend which can be used instead of gdb; to use the frontend, try ddd or xxgdb.

Problems in porting Fortran programs

By its very nature Fortran is a difficult language to program reliably. In almost all cases, if your program doesn't work, it's your fault not the computer or the compiler. To have any hope of eliminating bugs you must

For example, it is easy to write Fortran programs which work correctly on a VAX or an IBM 3090, but which fail on ugrad (and vice versa). A common problem is that the VAX REAL*4 type is identical to a truncated version of the VAX REAL*8 type, so that if you pass a REAL*8 argument to a subroutine that expects a REAL*4 it will appear to work on a VAX (although your accuracy will be reduced). Such a subroutine will fail (as is reasonable) on ugrad.

If you read/write to a file without specifying its name in the OPEN statement, then Fortran will refer to the file as fort.xx where xx is the unit number of the file. For example, the Fortran statement

        READ (10) I

will attempt to read from the file fort.10 in the current directory. If you want this to be another file, e.g. ../data/myfile.dat, then either use the NAME$=$ parameter in an OPEN statement, or create a logical link to this file before running your program:

ln -s ../data/myfile.dat fort.10

A common problem with programs is that they fail with a ``bus error'' or ``segmentation violation''. This is usually caused by an attempt to read/write an area of memory that is not accessible to the program. For example, if you write to the 1001'st element of an array with only 1000 elements, then you may get a ``segmentation violation''. Similarly, if you call a subroutine with a fixed argument, as in

call mysub (12.34)

and if mysub attempts to change its argument, you may get all sorts of strange errors later on in your program.

If you want to write portable programs that have a high probability of being correct, then you need to program in a different language, such as PASCAL, ANSI standard C, MODULA-2, or MODULA-3. These languages prevent a lot of the problems associated with poor compile-time checking in Fortran.

Fortran tutorials on the Web

Fortran tutorials can be found here:


See the Physics home page using your favourite WWW browser for C programming course notes written by Michael Ashley.

C source filenames must end with the characters ``.c''. The syntax used to call the compiler is similar to that for Fortran (in fact, the Fortran compiler converts your program into C and then calls the C compiler).

cc test.c -o test

You may also consider using the GNU C compiler gcc, which is a standard compiler available on many different computers and operating systems. Under some circumstances gcc will produce faster code than the default (native) C compiler.

See the discussion on make in the section on Fortran programming.


Pascal source files must end with the characters ``.p''. The Pascal compiler is called `pc'', and has similar semantics to the Fortran and C compilers. See `man pc' for details of the options. The Pascal compiler is currently unavailable on the Physics workstations.

Standard mathematical libraries

The workstations have a variety of libraries for solving mathematical. To use such libraries you typically need only supply the -llibrary switch to the compiler.


To link with NAG simply add the -lnagf77 switch after your program source files in the f77 command, e.g.

f77 prog.f -lnagf77 -o prog


The HP Tru64 UNIX ``DXML'' ( Digital Extended Math Library) package includes BLAS (1,1E,1S,2,3 as of this writing) and LAPACK linear algebra and eigenvalue problem solving libraries. To link with DXML add the -ldxml switch after your program source files as per the NAG example above. See ``man dxml'' for detailed information on the DXML package.

Other workstations may have BLAS and LAPACK installed conventionally as separate libraries. In such cases, use the -llapack switch after your program source files. For example, to compile with ifc the Fortran program sp1 which uses LAPACK routines, use

ifc -w sp1.f -llapack -o sp1

On some computers that rely on RPM (a package manager), the installation may require use of unintuitive compiler options. For instance, on some RedHat systems it has been found necessary to link with BLAS/LAPACK thus,

ifc -w sp1.f -llapack -lg2c -o sp1

In the above, the requirement to link with libg2c exists because the LAPACK library was compiled with GNU f77.

Numerical Recipes

The source for Numerical Recipies may be available on some workstations in /usr/local/recipes--the legal restrictions on Numerical Recipies, however, are so severe that it is not allowable for anyone to use them.

The following subsections detail some of the available packages.

Fortran to C converter

The program f2c will take a Fortran source file and generate a C equivalent, which you then have to link against a couple of emulating libraries. f2c may be useful in the case that the Fortran compiler generates buggy code, or if you wish to port a Fortran program to a machine that doesn't have Fortran.

The procedure for making a binary is

f2c prog.f

which creates prog.c, and then

cc -L/usr/local/lib t.c -lF77 -lI77 -lm -lc

to generate the binary.

Image processing software--IRAF

IRAF, the Image Reduction and Analysis Facility, written by Kitt Peak Observatory in the United States, is available on astro only. To use it for the first time, type the following commands

mkdir iraf
cd iraf
cl              ! from within the xterm
To use it subsequently, all you need to do (after starting up an xterm) is
cd ~/iraf
cl stands for ``command language'', and is the IRAF user interface. Once in cl you can type help for information, or logout to get back to the UNIX shell.

Miscellaneous local software

The following programs are not part of the usual UNIX command set, and have been obtained mostly from public domain sources.

a2p awk to perl converter
a2ps ASCII to PostScript converter
bzip2 Bzip2, better and slower than gzip
convert Imagemagick, converts images to many different formats
display Imagemagick, converts images to many different formats
dvips dvi to ps converter
emacs text editor
enscript ASCII to PostScript converter
gmake GNU make
gtar GNU tar, better that real tar
gzip GNU zip, better than compress
less an improved version of more
patch a program for applying diff output to a package
perl replacement for sed and awk
tin USENET news reader
s2p a sed to perl converter
tcsh an improved version of csh
top for examining CPU usage
tex typesetting package
xdvi TEX previewer for X-terminals
xmodem for transfering files to/from a microcomputer
xv for displaying GIF (and other formats) images on an X-terminal
zsh an improved version of ksh

New items of local software will be added on an ongoing basis. On FreeBSD systems use the command portversion -O |most to get a list of locally installed packages. Use pkg_info to list detailed information on a package, for example to list information for the ddd package,

pkg_info ddd$\backslash$*

Running numerically intensive jobs

Batch queues

Batch queues are generally not necessary when using UNIX. This is quite a different situation from the usual mainframe way of doing things.

Suppose that you have a program called model which you want to run ``in the background'' (i.e. have the computer run the program without tying up your terminal), then all you have to do is,

model&                         ! see note below on the "nice" command
The & at the end of the line instructs UNIX to run the program detached from your terminal. In other words the program will start running simultaneously with your login session, and will even continue running after you logout. As a general rule you should reduce the priority of all the background jobs that you start unless you specifically require interactive priority. To run a background job the correct command is then
nice model&
This will run model at a priority that will not affect interactive users. (By the way, the command is called nice since when you use it you are being nice to other users). If you do not nice your background jobs, the operating system detects this fact and will automatically renice them to a lower priority based on the cumulative amount of cpu time that the job has used. It is in your interests to nice the jobs yourself, since the operating system will give preferential treatment to those jobs rather than ones that it has had to renice.

You can have lots of jobs running in the background, however, the operating system will give all but one of them the lowest possible priority. In general, therefore, it is in your interests to run jobs sequentially.

Their is no advantage to you in trying to run a numerically intensive job interactively (i.e. in the foreground). The operating system detects that you are using lots of CPU time and then treats your interactive job just like a batch job. When your job is finished your priority will be very low and you may notice slow response from the computer.

The priority adjustment mechanism is potentially very flexible. It will have to modified in the future as we accumulate experience with the types of jobs that people want to run. If you have specific problems with the way that priorities have been assigned to your jobs, send e-mail to The system has been designed in an attempt to be fair to all users, and attempts to circumvent it will be regarded darkly. In extreme cases your jobs may be terminated without warning. Tricks such as running your jobs under multiple usernames (e.g. a staff member using the account of an Honours student, as well as his/her own), are not in the spirit of fair play.

Once you have placed a job in the background, you can return it to the foreground (i.e. attach it to your interactive terminal session) by using

fg %n ! fg stands for foreground

where the number n was obtained from the list of your background jobs given by the command jobs. The number can be omitted if you want to attach the last job you backgrounded. (Note: jobs only lists those jobs that you have started in the current session, to see all your jobs use the ps -x command).

Sometimes it happens that the program you want to run in the background requires some input from the user before the computations get under way. To do this you start the program in the foreground, enter the data, suspend the program, and then restart it in the background. An example follows:

model                             ! start the program
input number of iterations> 10    ! here is some user input
input value of pi> 3.14159        ! more input
^Z                                ! this is a control-Z it stops model
bg                                ! this puts model in the background
Note that if your batch job sends output to your terminal (stdout) it will do so even if running in the background. If you then logout, the batch job will die since it has nowhere to write its output. The solution to this is to redirect the output to a file, or to /dev/null if you want to throw it away, e.g.
nice model>&/dev/null&
/dev/null is a special file which will accept any amount of data, and simply discards it. For more information about foreground and background jobs and setting job priorities, see man csh.

UNIX also provides the at and batch commands for submitting command files for later execution. For example, suppose that you create the following command file called run.model

#!/bin/csh                        ! use csh as the shell
/bin/rm -f fort.1 fort.2          ! delete some files
ln -s mydata fort.1               ! link mydata to fortran unit 1
ln -s modeloutput fort.2          ! and link modeloutput to fortran unit 2
model                             ! start the program, called model as before
Then to submit this job to start at 4am on July 4, you use
at 4am jul 4 run.model
To submit the job as soon as possible based on the load of the system, use
batch run.model
For more information on at and batch, see man at.

Finally, if you want to stop a job, use one of the following kill commands,

kill %n                  ! where n is the job number (from the "jobs" command)
kill n                   ! where n is the process id (from the "ps -x" command)

If you wish to place limits on the cpu time that your program can use, try the limit command (documented in man csh). This is a good idea to stop potential infinite loops.

Writing numerically intensive programs

Since the computer assigns job priorities partly based on the amount of cpu time that a job has used, you will find that if you start using many hours of cpu time, your jobs will get the lowest priority. So for fast turnaround it is essential to spend some time making sure that your program is as efficient as possible. If programming in Fortran it is well worth reading a guide on optimizing Fortran programs. A common mistake that people make is to choose the wrong order in which to increment array indices. The following code fragment is the wrong way to add two arrays:

      do i = 1, 10000
        do j = 1, 5000
           a(i,j) = b(i,j) + c(i,j)
        end do
      end do
It should have been coded like this:
      do j = 1, 5000
        do i = 1, 10000
           a(i,j) = b(i,j) + c(i,j)
        end do
      end do
Since Fortran assigns arrays in memory with the first index varying most rapidly, the second example results in contiguous areas of memory being addressed whereas the first example jumps all over the place. Depending on the size of the arrays the difference in execution time could be a factor of 1000.

There are numerous other tricks of the trade for speeding up programs. It is a rare program that can not be sped up by factors between two and ten. If your program still requires hours of cpu time then you should do the following:

To maximize the performance of a numerically intensive program you should keep any disk or terminal I/O to an absolute minimum. Any disk activity will result in the program coming to a standstill while it waits for the disk to be available, and the priority of the job will plummet.

Checking the progress of your job

Use ps -x to obtain a list of all the processes that you have running (see man ps for a list of options). Use jobs to find the processes that you have started in your current login session. Use ps -aux to get a complete list of all the processes on the system. Use top to see the fraction of CPU time that your job is using (although please don't leave top running for hours since it uses up CPU time itself). Please kill any jobs that you no longer need.

Programs requiring huge memory allocation

UNIX is a virtual memory operating system, and you can run programs which use up to a maximum of 1 GByte of memory. How efficiently such a program will run depends crucially on how you access the memory. Sequential access is always the fastest since the computer has high speed caches that anticipate you will use memory sequentially. The Physics workstations have between 256 and 384 MBytes of semiconductor memory but you shouldn't expect to be able to run efficiently a program that uses an inordinately large percentage of available physical memory.

Programs requiring huge time allocation

If you expect that your program will run for more than a day, you must write out intermediate results so that you can continue where you left off if the computer crashes or if it has to halted for administrative reasons. Normally a day's warning will be given of computer downtime, and any batch jobs which are still running at the time of the shutdown will quietly die.

School policy on multiple numerically intensive jobs

The School has a policy whereby a user may run only one numerically intensive job per workstation. This policy has been formulated to provide a more even distribution of workstation resources per user and to discourage ``hogging''. It is acceptable, of course, to run single numerically intensive jobs on more than one workstation at a time.

Other facilities

Where raw processing power is needed for numerically intensive computing, some users may find it to their advantage to seek accounts on machines external to the School. Such resources are listed in the Facilities Guide, which can be found on the Web at

Comparisons between UNIX and other operating systems

The following sections may be useful guides if you are familiar with the VMS or MS-DOS operating systems.

Comparison between UNIX and VMS

The UNIX and VMS operating systems both have advantages and disadvantages and there is no answer to the question ``which one is better?'' The main reason that UNIX has become so popular is that it is runs on many different types of machines, not just on Digital Equipment Corporation VAXes. It is also cheaper to buy and it is typically many times faster than VMS on machines of similar cost.

Here are a few comments on the differences between UNIX and VMS from a user's perspective (albeit one biased in favour of UNIX).

When all is said and done, after using UNIX for a few months you will not want to use VMS again.

The following table gives rough equivalences between VMS and UNIX commands. Note: the less command is a local addition.

VMS command Nearest UNIX equivalent
CC file.c cc file.c
COPY file.1 file.2 cp file.1 file.2
COPY *.dat *.txt foreach dummy (*.dat)
      cp $dummy $dummy:r.txt
CREATE file cat $>$ file
    body of text     body of text
    ^Z     ^D
CREATE/DIRECTORY [.subdir] mkdir subdir
DEFINE name meaning alias name meaning
DELETE file rm file
DELETE *.*;* rm *
DELETE/CONFIRM file rm $-$i file
DELETE/NOCONFIRM file rm $-$f file
DELETE [...]*.*;* rm $-$R *
DELETE/ENTRY=number SYS$PRINT lprm number
DELETE/ENTRY=number queue lprm $-$Pprintername number
DIFFERENCES file.1 file.2 diff file.1 file.2
DIRECTORY/OUTPUT=file.lis ls $>$ file
DUMP file od file
  or   hd file
EDIT file emacs
  or  vi file
  or  ed file
Fortran file f77 file.f
Fortran/DEBUG file.for f77 $-$g file.f
HELP topic man topic
  or  man $-$k keyword
LOGOUT logout
  or  ^D
MACRO file.mar as file.a
MAIL mail
MAIL/SUBJECT=subj file user mail $-$s subj user $<$ file
PRINT file.txt lpr file.txt
PRINT/QUEUE=queue file lpr $-$Pprintername file
RECALL/ALL history
RENAME file.1 file.2 mv file.1 file.2
RUN program program
SEARCH file.* string grep $-$i string file.*
SEARCH/EXACT file.* string grep string file.*
SET DEFAULT [.subdir.subsubdir] cd subdir/subsubdir

VMS command Nearest UNIX equivalent
SET FILE/PROTECTION=(o:rwed,g:,w:) *.*;* chmod 700 *
  or  chmod go= *
SET FILE/PROTECTION=(o:rwed,g:re) *.*;* chmod 750 *
  or  chmod g=re,o= *
SET HOST machine rlogin unix_machine $-$l username
  or  telnet vax_machine
SET PROMPT "> " set prompt = "> "
  and  ps -x
SHOW QUEUE print_queue_name lpq $-$Pprintername
SHOW QUOTA quota $-$v
SHOW SYSTEM ps $-$aux
  or  w
  or  who
  or  finger
SORT sort
STOP/IDENTIFICATION=number kill number
SUBMIT batch
  or  at
TYPE file.txt cat file.txt
TYPE/PAGE file.txt less file.txt
  or  more file.txt
WRITE SYS$OUTPUT "hello world" echo hello world

Comparison between UNIX and MS-DOS

UNIX and MS-DOS have much in common, primarily because MS-DOS was partly developed using ideas from UNIX. Here are some of the major differences:

The following table gives rough equivalences between UNIX and MS-DOS commands. As you can see, there are many similarities. Note particularly the UNIX mechanism for putting a directory name into the prompt string (for more details, see man tcsh).

MS-DOS command Nearest UNIX csh equivalent
attrib +r file chmod u-w file
backup tar c
cd tex$\backslash$thesis cd tex/thesis
cd .. cd ..
cd pwd
comp file.1 file.2 diff file.1 file.2
copy file.1 file.2 cp file.1 file.2
copy file.1 $+$ file.2 file.3 cat file.1 file.2 $>$ file.3
copy con file cat $>$ file
    body of text     body of text
    ^Z     ^D
del file rm file
dir ls -l
echo hello world echo hello world
find "string" file grep -i string file
mkdir dirname mkdir dirname
more $<$ file more file
  or  less file
path %path%$\backslash$bin setenv PATH ($path /bin)
print file lpr file
prompt $g set prompt = "%$ \tilde{}>$ "
rename file.1 file.2 mv file.1 file.2
restore tar x
rmdir dirname rmdir dirname
set name = meaning setenv name meaning
sort file sort file
type file cat file
xcopy dirname cp -R dirname

About this document ...

Physics Workstation Guide

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.70)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -html_version 4.0 -short_index -split 0 -link 10 -t 'Physics Workstation Guide' -local_icons guide.tex

The translation was initiated by Physics IT Support on 2006-06-22


... directories1
The default permissions are set by the line ``umask 077'' in your .login file; see man umask for more information.
Physics IT Support 2006-06-22