Penn State EMS Environment Institute
Environmental Computing Facility


General Questions

How do I start a job and logout, but leave it running?

This is called backgrounding a job. There are several ways to do this. You can start a process (called job) in the background by typing:

host:user[nn]% job > outfile &

The first part of the line is your prompt. The ampersand (&) puts the job in background and lets you have control of the terminal. In our "flavor" of UNIX this background job doesn't die when you log off. That's why I've redirected the output of the job (that would normally go to the terminal) to a file. In some cases the next person on that same terminal after you will see all the output from your job if you don't redirect it to a file. This is a matter of courtesy with the side effect that it increases your job's performance if the job writes a lot to the screen.

Another way to put a job in background is to type a control-z (that's holding down the control key type z). This "stops" the jobs and then you can type bg or fg to restart the job in the background or foreground respectively. This also gives you the process id of the job which you can use to monitor or kill your job. See the "Job Control" entry for more details on this. It is very powerful.

ALSO: If your job is going to take more than a few minutes please invoke it with the nice command. This is a courtesy to other users (especially on the servers) and also helps UNIX schedule your jobs better. The syntax is:

host:user[nn]% nice job > outfile &

For more information on "nice" see the man page or the "Please nice your jobs" entry. There is also a renice command in case you forget to start your job with nice.

I can't find the background job I just started!

"I just ran a job in background and it's not there!"

The command ps without arguments doesn't list the background jobs that you may have started during your session. Many users make the mistake of starting the job again and again because they can't see it running. To check for a job in the background type:

ps -aef

This will show you jobs that you've put in background. A useful alias that we provide is "psa" which gets all the processes on the machine and edits out those which are run by the system. In case you've overwritten this in your .login file the command does this:

/usr/ucb/ps wwagux | egrep -v root | egrep -v egrep | more

This gets all the processes, removes those run by root (egrep -v prints all lines which do not contain that string), removes your egrep process and puts them in the pager (more).

You can also search for a particular job by using psq processname (where process name is the process you're searching for).

How do I access the floppy drives on the Sun workstations?

The floppy drives on the Suns can be used to read and write MS-DOS formatted 3 1/2 " floppy disks.

If your floppy disk has not been formatted yet, it must first be formatted with an MS-DOS filesystem. To format the disk, make sure that the write-protect tab is in the "write" position, and insert it into the floppy drive (top side up, with the end with the metal shutter inserted first). Then enter the command:

	fdformat -d

You will be prompted to press the "Return" key when you are ready, and then the disk will be formatted, with a sequence of dots written to the screen as this is done. Remember, DO NOT reformat your disk if you've already formatted it on the Suns or a PC and it contains data which you want to transfer to the Suns!

After you have formatted the disk, or if it is already formatted, insert it into the Sun's floppy disk drive if you have not already done so to format it. (Remember, it must be write-enabled.)

Once the floppy is in the floppy drive type, "volcheck". This command activates the Solaris volume management software to automatically mount the floppy disk as a UNIX filesystem. Alternatively, you may type "floppymount" to mount the floppy. In either case, the floppy will be mounted as /floppy/floppy0. You may now access it as any other UNIX filesystem. For example:

ll /floppy/floppy0Gives a directory listing of the files in the /pcfs directory
cp /floppy/floppy0/file1 .Copies "file1" from the floppy to the current working directory
cp file2 /floppy/floppy0/file2Copies "file2" from the current working directory to the floppy
cp /floppy/floppy0/* .Copies all of the files on the floppy disk to the current working directory.
mkdir /floppy/floppy0/myfilesCreates a subdirectory on the floppy disk named "myfiles"
rm /floppy/floppy0/file3Deletes the file named "file3" from the floppy disk

When you are finished with the floppy, simply type "eject floppy" or "floppyumount" to unmount the floppy and eject it from the drive. Note that if you are still in the /floppy/floppy0 directory, the OS will be unable to eject the disk, so you may want to "cd" to your home directory before typing "eject floppy" or "floppyumount".

PLEASE NOTE!

One thing to keep in mind is that even though the floppy disk is mounted on a Unix workstation, it is formatted as an MS-DOS disk, and thus imposes the same filename limits as a PC; ie. in the name "file.ext", the 'file' part of the name to the left of the dot must be no more than 8 characters, and the 'ext' part to the right of the dot must be no more than 3 characters. Any names with parts longer than those limits will have the part exceeding the character limit truncated. Also, there is no concept of ownership and permissions on the floppy disk; all files will be owned by whomever mounts the disk (regardless of who wrote it), and the permissions will be "777" -- anyone will be able to read, write, execute, or delete any file on the floppy.

How do I read CD-ROM disks on the Sun workstations?

Several of the Sun workstations have CD/ROM drives attached to them with which one can read CD/ROM disks. First, find one of the machines with an attached drive and log into it.

Some of the CD/ROM drives require that the CD first be inserted into a carrier before being used in the drive. These drives have a large slot on the front of them which is approximately 5 inches wide and 1/2 inch high, covered by a hinged door. Usually there will be a carrier available near the drive or already inserted into the slot. The top side of the carrier has a clear plastic cover. To read a CD, open the carrier cover and place the CD into the circular well in the center of the carrier, with the CD label facing up. Close the cover, then insert the carrier into the CD drive slot, cover side up with the end with an arrow on it inserted first.

Some other CD/ROM drives have a drawer-like apparatus which extends from the drive when a button is pushed, and into which the CD is placed to read it. To insert the CD, push the eject button and wait for the drawer to extend. Place the CD label up into the drawer, and push the button once again. The drawer mechanism will retract and load the CD.

When loading a CD into either of the two types of drives, never use force to insert the carrier or close any part of the drive. If you are unsure of the procedure or have any questions, ask other people in the area if they can be of assistance, or contact the administrators (e-mail to "sysadmin").

All of our Suns run the Solaris Operating System, which means that when you put a CD into the CD-ROM drive, the system will automatically mount the CD on directory /cdrom/cdrom0.

After mounting the CD, you can read from it, copy from it, use files on the CD as input to programs, etc., simply by accessing files in the /cdrom directory tree in the same manner as any other Unix files. For example:

ll /cdrom/cdrom0Gives a directory listing of the files in the /cdrom directory
cp /cdrom/cdrom0/file1 .Copies "file1" from the CD to the current working directory
cp /cdrom/cdrom0/* .Copies all of the files on the CD disk to the current working directory.
cd /cdrom/cdrom0Changes the current working directory to /cdrom, the CD.

When you are done using the CD, you may unmount and eject the disk by typing

	eject cdrom

Leave the carrier on top of the drive if you were using a carrier, or push the button on the drive again to retract the drive drawer mechanism on that type of drive.

What visualization, graphics, and plotting software do we have?

IDL The Interactive Display Language is a product from RSI IDL allows you to display an manipulate images with powerful image processing, matrix, and data maniputlation utilities and a very capable command language.
Matlab A visualization program that is particularly good at matrix manipulation. We also have the Matlab Signal Processing and Neural Network toolkits.
GrADS The Grid Analysis and Display System. Like the name says, it is used for grid analysis.
Freud Freud is a user interface for visualizing datasets.
GMT The Generic Mapping Tools data processing and display software package. GMT is a collection of public-domain Unix tools that allows you to manipulate x,y and x,y,z data sets.
AVS The Application Visualization System (AVS) is an interactive tool for scientific visualization.
Ferret A Data Visualization and Analysis Program - especially tailored to meteorologists and oceanographers but it is of general applicability.
NCAR Graphics A geographically oriented visualization and mapping package from the National Center for Atmospheric Research. For more details, visit the NCAR Graphics WWW page at URL http://www.ucar.edu/distserv.html.

Using TeX and LaTeX

What are TeX and LaTeX?

TeX and LaTeX are two powerful scientific document processing packages. TeX was written by Donald Knuth for creating all sorts of scientific documents. LaTeX provides templates for TeX for commonly used formats like letters, articles, reports, etc. The TeXbook by Donald Knuth is the definitive text on TeX. We recommend a book called "TeX for the Impatient" by Paul W. Abrahams. It's a good book for beginners and those that would like to learn how to do something without pouring through the details. "LaTeX. a document preparation system" by Leslie Lamport is a good guide for the basic templates and features of LaTeX.

How do I run TeX/LaTeX at the ECF?

Create your TeX (or LaTeX) file in your favorite editor (emacs has a TeX and LaTeX major mode). Once you have a file (called text.tex in our examples) invoke TeX or LaTeX like this:

tex text.tex

or 

latex text.tex

The program will give you some logging output and create a .aux and .log file. The .log file will be the output from TeX or LaTeX. You can examine this if there are any errors. The program will also create a file with a .dvi extension. This is the Device Independent format that both TeX and LaTeX use.

Note: Although the TeX/LaTeX source files in these examples will have a ".tex" extension, this is only a convention (it also makes it easier to find your TeX documents).

How do I view a .dvi file?

There are several methods of viewing these files depending on what type of machine that you are running on and the operating system that it runs. The program which allow you to view dvi files is "xdvi". To invoke this command on the file "text.dvi" type:

xdvi text.dvi

If you are displaying the file from another machine, make sure $DISPLAY is set according to the "How do I display a remote X application on my local workstation?" FAQ.

"xdvi" allows you to view the dvi document at several magnifications and move back and forth between pages. It also contains a magnifier which you get by depressing any of the three mouse buttons and holding it. Each button gives you a different size magnifier. These magnifiers allow you to get a detailed view of small regions of TeX output.

How do I print a TeX/LaTeX document?

There are also two programs which do this, dvips and dvialw. Both are designed to convert the DVI file which results from compiling your TeX file to PostScript and either save it to a file or send it to the printer.

dvialw

"dvialw" is a program designed for Apple LaserWriter II type printers (300 DPI PostScript). It works pretty well, but doesn't support the TeX "\special" command which is the easiest way to include graphics in TeX files. To print directly to the printer type:

dvialw < file.dvi | lpr

To save a PostScript file to the local directory type:

dvialw file.dvi

This will save a file named "file.dvi-alw" to the current working directory. To print this file, just use "lpr". To find out more about printing a file check out the "How do I print a file?" FAQ in the main FAQ directory.

dvips

"dvips" is a program that allows the user to scale fonts to a specific printer or save a PostScript file. The typical user previews TeX output with a dvi previewer and then uses dvips to send the TeX output right to the printer, so that's the way we have it set up. Issuing the command:

dvips file

will send the "file.dvi" to the printer that is specified as the system default or in your $PRINTER environmental variable.

dvips -o file.ps file

will save the PostScript output in a file called "file.ps" for the DVI file "file.dvi". To print this file, just use the "lpr" command.

Finally, since dvips can scale fonts for your printer, you should consider they type of printer that you print to. An HP LaserJet 4m prints by default at 600 DPI. The default font size for dvips is 300 DPI (most of the old printers). To scale these fonts and realize much better TeX output use dvips like this:

dvips -o file.ps -D 600 file

If you are using fonts outside of the normal "Computer Modern" 10-, 11-, and 12-point fonts, you may see that dvips invokes a program called METAFONT to generate these fonts on the fly. Most of the "typical" fonts and font sizes are already there.

What are some common LaTeX templates?

Letters \documentstyle[12pt]{letter} for a letter in 12-point font
Articles \documentstyle[11pt,doublespace]{article} for an article in 11-point font, doublespaced.

Can I write my thesis using a LaTeX template?

There is a LaTeX template called "psuthesis" that conforms to the Penn State Thesis Guide. It also has a companion BibTeX style that lets you cite articles, books, etc. for your thesis. The styles, documentaion and sample chapters and bibliographies can be found in the directory (on the Suns):

/usr/local/src/psuthesis

To use the psuthesis style, begin your document with:

\documentstyle[11pt,psfig]{psuthesis}

Note: The psfig style allows you to enclose PostScript diagrams in your thesis.

Using tape drives

How do I read/write to a tape?

UNIX provides several methods for reading and writing a tape. Two programs, tar and dump (or ufsdump for System V revision 4), are for archival/backup purposes and can be used on a wide variety of files and devices.

tar is the tape archiver and is used to write multiple files and/or directories to a tape device. tar preserves the directory structure which is why i t is very useful for backing up your entire user account or workspace. A typical tar command to write a backup tape is:

        tar cvf /dev/rmt/0mn .
            ^^^       ^      ^
            |||       |      |___ directory to backup (current directory here)
            |||       |___________tape device name
            |||___________________use the next argument as the file to write
            ||____________________verbose mode
            |_____________________create a tape archive

An important piece of advice here is to always us "." as the argument. It causes the tar archive to be written using path names relative to the current directory rather than specifying them in absolute terms starting at the root directory "/". If you go somewhere else which doesn't have a /home/geosc for instance (most sites don't :-) ) then you can restore the tar file to whatever your new home directory is rather than make you system administrat or create a /home/geosc and then move your files.

To "un"tar a file use the command:

        tar xvf $TAPE
            ^^^    ^
            |||    |_________ "un"tar from $TAPE tape device
            |||______________ use next argument ($TAPE) as file to read
            ||_______________ verbose mode
            |________________ eXtract from tar file

The verbose flag writes each file name as it is create or extracted. If you don't use this flag, tar will only report errors. Sometimes it is good to leave the verbose flag off if you have many files and suspect errors. Only the errors will be reported and they won't be lost in the scrolling of fil e names.

The "t" flag in place of the "x" or "c" just lists the table of contents on the tape. This is good to try if you're not sure if the tape is a tar tape or not. See the man page on tar for additional flags and information.

The dump (or ufsdump) command is good for backing up entire disks and as such is often used to backup entire computer filesystems. The man page lists the various block and densities for the different tapes that we use and the dumper script optimizes these choices for those type tapes. The restore (o r ufsrestore) command lets you interactively write a dump tape file back to disk. Many times it's better to do this to a temporary directory and then move what you need to the permanent area, although dump used interactively will warn you if you try to write over an existing file with the same name.

Files can also be placed on tape via the dd command. Among other uses for dd it can be used to place a whole tar or dump diskfile onto to or off of ta pe. An example is:

        dd if=filename of=$TAPE bs=96b
           ^     ^     ^    ^      ^ 
           |     |     |    |      |______ 96 512 byte blocks ( 48 MByte)
           |     |     |    |_____________ $TAPE file
           |     |     |__________________ output file flag
           |     |________________________ file name
           |______________________________ input file flag

This command places a file called filename onto the tape device $TAPE 96 blocks at a time (per write). Switching "if" to $TAPE and "of" to filename wr ites the file from tape to disk. dd also has many nice conversions (conv= flag). See the dd man page for details.

Finally, since tape devices are setup as special files, programs can open tape drives as a file and actually do low level (read/write) i/o directly to/ from a tape.

What tape drives are available on the network?

We have a variety of tape media, tape drives, and tape capacities available. Please contact sysadmin@essc.psu.edu to find out what drive would be most convenient for you to use.



Back to the index