Department of Physics and Astronomy - Computer Facilities

Brief Introduction for New Unix Users

While intended as a general introduction for Unix use, this was written with Sun machines in mind. Some statements may be Sun specific. Please note that there are slight differences between UNIX standards of various manufactureers (SUN, SGI, IBM, DEC,...).

Contents:

Introduction

This short note is designed to be a very elementary introduction to UNIX computing at the Physics Department. It covers only the most rudimentary things, but it provides pointers to more information.

We assume that you have been given an account on the Physics Department Suns, and have been told your username (perhaps jsmith ) and a preliminary password (say 123).

Logging on and off the computer

The first thing you must know is how to log into and log off of the computer. Be sure you always log off when you stop using the computer, for otherwise anyone can sit at the machine and tamper with your work or e-mail eventually causing ireparable damage. You will be held responsible for anything done by someone logged in as you.

Logging on, or login

In general, when you want to do computing, you can find a computer which is not in use. These can be found in Serin public computing rooms 103, 341, 383 and in ARC room 230 or in the offices where you might have permission to use particular machine. If connecting remotely machine name everyone should login into for their general computing needs on the Suns is physics.rutgers.edu The machine may be displaying the screensaver, or it may be blank. Moving the mouse or hitting a keyboard key will give one of the following:

This should get you logged onto the computer.

There are some options in the log-in window for Sun machines. Pressing the OK button or enter key would submit your username/password. Start Over button is usefull to start over when your attempt for logging in has failed and hung-up (for example due to a network failure). The Help button is there for help instructions. Options gives you several menu choices. Language is set to English by default, but you are welcome to try other languages for a system communication if you please. The Session menu offers CDE (Common Desktop Environment), Gnome, Last Desktop and Fail Safe options. CDE and Gnome are two similar yet different Graphic User Interfaces (GUI) which X windows can use. Within each of them you can customize settings (say background or applications open by default) and save them. The Last Desktop option makes use of this: if you chose it, it will open your desktop environment as you have left it when you logged out last time. Fail Safe session opens just plain (non-X) terminal window. It is useful when one has problems with the system and wants to avoid eventual problems when X windows open.

Password

The first thing you should do with your new account is to make sure that your password is known and knowable only by you. If you have been assigned a password by the administrator, you must change it right away. First decide on a new password. It should have at least 8 characters, should contain at least three of 1) lower case letters, 2) Upper case letters, 3) numbers, 4) punctuation and 5) other characters. It must not be a word found in the dictionary. (ANY dictionary! If you choose a word in Romanian, there is a good chance the hacker trying to guess your password expects it to be in Romanian and has a Romanian dictionary.) In fact, there are all sorts of other restrictions too, so you may need to try several choices before one works. Take this step seriously.

Computers have gotten far more complex than you imagine, and our machines are subject to break-ins from anywhere in the world. The most common way for hackers to break in is to guess a user's password. Hackers may often do no damage but could do very severe damage, including getting us permenently banned off the Internet for abuses, so don't be negligent about your password.

Also, don't share your password with others. Anyone with a legitimate reason to get on our computers can get an account, and doesn't need to use yours. If you need to share files, this can be arranged without sharing passwords. You will be held responsible for anything done by someone logged in as you.

In the examples shown below, what you type is in typewriter bold if you are to type it literally, or italics if it represents something you choose and type. Every line of a command needs to be followed by a <ret> . What the machine types is in typewriter font.

To change your password, enter the command
physsun4% passwd
Old password: old-password........... Type old password. It will not be shown. Follow with <ret>
New password: new-password........... Type your new password. Follow with <
Retype new password: new-password

If you did it correctly, your password will be changed as indicated by the message
yellow pages entry changed on physsun5.rutgers.edu

Changing password on one physsun[n] machine, changes it on all of them in the cluster. You do not have separate password for each physsun[n].

Don't forget your password, but don't write it down where anyone can see it either!

Logging off

To log-off, in CDE X window environment you just press EXIT button at the toolbar. Answer any prompt displayed by the computer by left-clicking on appropriate buttons. Wait and check that the log-in window appears, indicating that you have successfully logged-out. Similarly in Gnome X windows click on Gnome meny link on the toolbar and pick "logout" icon.

If you cannot log off the computer, get help. Send mail to help@physics.rutgers.edu.

Both for security purposes and to avoid causing your dead or run-away processes to eat-up computing resources and initiate computer hang-ups:

Don't leave yourself logged in!

X windows GUI

After succesful log-in you will start (typically) a X window session in either CDE or Gnome. Use of these two GUIs is similar, but appearance and customization are different. Essential functions in CDE environment might be accessed from the toolbar with quite obvious icons at the bottom of the screen and by right-clicking on the empty portion of the screen and using the menu that will appear. Gnome is a second choice on Solaris9 computers instead of Solaris7/8 OpenWindows. Gnome is well-known among Linux users. By default in either GUI some kind of help-manager will pop-up during your first session. You can keep it open and learn or close it and recall it when needed from the menu. To start terminal window in CDE, use right-click menu, choose PROGRAMS and in the following menu opt for TERMINAL or CONSOLE at your convinience. 4 panels on the CDE toolbar labeled One, Two, Three and Four are buttons which can switch you between 4 different desktop areas, all of which you can use at will. In Gnome you may launch a terminal window by right-clicking for a menu, choosing Utilities and within them Console. In both environments minimized applications remain displayed on a screen as icons. Applications can be accessed either by chosing them from menus, clicking on their icons or by running them from the terminal window. Note that if you enter command mozilla (or any other application) in a terminal window, terminal window will be locked-up by that application. Using mozilla & will allow you use of that terminal window even after application have begun. Eventual error messages from the application will still appear in that terminal window. In both environments menus allowe you customization of appearance, start-up session, defaults, etc.

For more detailed overview of CDE and Gnome 2.0 documentation.

For more information about using X windows at Rutgers University please see RUCS maintained page on this subject.

Using the keyboard

Computer keyboards are somewhat more complicated than an ordinary typewriter, but you will not use all of the keys. We will discuss just a few things you will need to know.

You will be using the keyboard to enter commands to the computer operating system (or shell, and for preparing files or documents using an editor. Typing in commands to the ``shell'', or typing in text to an editor such as ``emacs'' or ``vi'', is done just by hitting the keys, as for an ordinary typewritter. However, you can correct mistaken keystrokes by hitting the <del> or delete key, repeatedly if necessary. Capital letters are entered, as on a typewriter, by holding down the shift key and hitting the letter key, then releasing the shift key. There is a second form of shift, called control. The control key works in the same way as the shift key (that is, you hold it down while hitting a character key), but it enters a different character, usually invisible. The use of such characters depends on whether you are ``talking to the shell'', i.e. entering a command, or ``talking to emacs'' or to some other program. An example: if you are entering a command and decide to scrap it without entering it, type ctrl-c, that is, type c while holding down the control key. In other documents, and in echos of your keystrokes, control characters are often written as ^C instead of ctrl-c.

In emacs editor , many of the control keys execute editting commands. For example, to exit from emacs you type ctrl-x ctrl-c. Emacs also uses the ``escape'' key <esc>. Escape is not a shift key, but an ordinary (though unprintable) character. So an emacs command involving escape, such as <esc> v, is entered by first hitting and releasing the escape key, and then doing the same for the v key.

Emacs also uses the arrow keys to move the cursor, which indicates the point of the text at which new characters will be inserted. These keys are usually found to the right of the normal keys, possibly on the 8, 2, 4, 6 keys of the ``numerical keypad''.

Most keyboards have an unfortunate ``Caps lock'' key, which enters a mode in which it is impossible to enter lower case characters. Some light will come on somewhere on the keyboard when in this mode. Hit the caps lock key again to clear it. You almost never want to be in this mode.

Many of the other keys on the keyboard also have unfortunate consequences, so try to avoid hitting them until you know what they do.

Files

Everything stored permanently on the computer ( i.e. stuff which remains after you log off) is stored in files. Files may contain text which is readable as is, or it may contain unreadable instructions only the computer can fathom, or it may contain information, readable or not, meant to be input to some program. Every file has a name, for example filename, which must not contain spaces or some other special characters. Each file is placed in a hierarchal structure known as the ``directory tree'' or ``file hierarchy''. If you are a novice user with username ``jsmith'', all of the files you make will be in one place, or ``directory'', in the hierarchy. This is most likely something like /home/jsmith. (Note: directories are called folders on Macs, Windows PCs, and will be on Suns too.) You will not need to know right away how to find files elsewhere, but when you get to the point that you have too many files to keep track of, you will want to read about the file hierarchy. The full file name of the file filename would be /home/jsmith/filename, which indicates its location as well as its base name.

Files which can be read directly are known as ``ascii'' files. Such files can be examined with the command more, say
more filename
You can see a list of the files you have by the command ls, which shows most of the files in your directory. ls -a will show you all of them, but you don't want to know about the ones starting with a period yet. ls -l will give you more information about each file.

Files may be created by a human using an editor, such as emacs, or they may be the output of some program.

Editing

The editor we support and most people use is named ``emacs'', or more correctly ``gnuemacs''. It is a very complex editor with capabilities that will satisfy the most sophisticated computer user, and unfortunately this means that it is not the easiest editor to learn. However, you can effectively edit after learning only a few of the commands. Paralel to emacs, some developers developed so called Xemacs. Commands and default start-up file (.emacs) are shared between these. Xemacs just has more GUI capabilities (as far as begining user is concerned).

There is a tutorial which you can run to learn how to use emacs. It is run by the command
teach-emacs

When you want more sophisticated information, you will find in /physics/doc/physics/emacs and some in /physics/doc/supplementary. There are also printed manuals and information about emacs on the Internet . But emacs is hugely complicated and no physicist should decide to set out to learn it completely, so take an evolutionary approach.

Printing Text

Files of certain kinds can be printed. You should only print things for which you have a good reason to want a paper copy --- look at the files on the screen first, and only print them after checking they are what you want, are correct, and asking yourself if you really need a paper copy. Remember that you can always look at the file in another window.

Printing is more expensive and more time-consuming than xeroxing. Please make only one copy and xerox it if you need multiple copies.

Readable ascii files can be printed with the command
lpr filename
You can check which print requests are not yet finished with the command
lpq
This will tell you the job number of your print request. If you realize that you shouldn't have printed it,
lprm job-number
will remove the request. Please be sure to pick up all your output, whether you want it or not.

The printing can be done at any one of several locations, as indicated by the printer names:
3w: Serin 346b
3t: Serin 383
2e: Serin 287
2w: Serin 246b
1w: Serin West, in corridor behind stockroom
arc: ARC 237
1s: Serin 103

The default printer if you print from computers in the ARC building is arc; on other computers the default printer will be something else. If you want to set a particular printer as your default regardless of which computer you print from, enter a line as follows in your .cshrc file in your home directory:

setenv PRINTER printername

If you want to print a single job on a printer other than your default printer, you can use the -P flag for lpr . For example,
lpr -P3w filename
will print filename on the third floor printer in Serin.

Other kinds of files are also printable. A properly constructed PostScript file, beginning with the two characters %! , will print satisfactorily with the lpr command. A .dvi file, say paper.dvi as produced by TeX or LaTeX, can be printed with the command
dvips paper.
Dvips also has many options to make it more flexible. For example
dvips -p4 -l10 -t landscape -P2e paper will print only the pages from 4 to 10, inclusive, in landscape mode, on the printer in Serin 277.

If you experience problems in printing, see Problems Printing PostScript Files. If you want to reformat postscript files, see Hints for reformatting Printing PostScript Files. Also, report any printing problems to printmaster@physics.rutgers.edu .

Programming

The Suns in the Physics Department support programming in Fortran and C/C++, and also in the symbolic mathematics languages Mathematica and Maple. It used to be that all physicists used Fortran, and Fortran is probably an easier language to learn at the beginning. C is more flexible and is standard on all Unix machines, but the advantages come only in the kind of programming more common in Computer Science than in Physics. C++ is now the fashionable, "object oriented" version of C. Java is also available.

I will not discuss the instructions of either C or Fortran in this document. There are many books available. The compilers we have on the Suns are

SUN compilers software contains full documentation locally (Following links will work only if you are reading this document from Physics Department Sun system).
There are other versions available if necessary.

For both languages, the steps in writing and running a program are the same. First you use an editor to create a file with instructions in that language. The filename should end in .f or .c or .cc or .java for Fortran, C, C++, and java programs respectively. The program must then be compiled, using the f77, CC, or similar command. Then it must be ``linked'' together with other functions that it uses, to produce an executable program.

This is most conveniently done using a very sophisticated Unix utility called make. A file usually called Makefile gives the compile and link instructions. Unless someone has set you up with an easy to use Makefile, you will need to do some reading on make before you can use it. One source is /physics/doc/physics/programming/make.doc.

As programs usually need correcting before they will compile correctly, the most efficient way to work on a program is to have the file in an emacs buffer. When you are ready, type

<esc> x compile <ret>

and then correct (if necessary) the compile command. If you have a good Makefile in place, it won't need correction, so just type <ret> . Emacs will open a second window, and tell you your errors, if any. The command
cntl-x `
will position your cursor on the line with the first error. Notice that is the open single quote, not an apostrophe, after the ctrl-x. Correct the mistake and type cntl-x ` repeatedly, correcting the errors as you go, and then give the compile command again.

Once you have a successful compilation and linking, you can execute your program just by using its name (without the suffix) as a command.

Mail

Electronic mail is both very useful and overused, so I want to encourage you to use it, but to do so in moderation. There are a number of different programs that can be used to read or send mail, which is unfortunate, because it means people have a harder time interchanging expertise. We currently recommend using the mailer of the Mozilla (or Netscape) browser. CDE dtmail mailtool can be used as well as program Pine .

You can learn about e-mail setup details particular for our Department from our e-mail setup web page .

In mozilla use HELP menu to learn about mail program and EDIT-PREFERENCES meny to set it up. To do proper setup, you will need to know your user name, pop server name: pop.physics.rutgers.edu and smtp server name: smtp.physics.rutgers.edu. There is good documentation on the web for using Pine:

Sending mail is very useful. It is easier to convey precise information, you don't wind up "playing phone tag", and you can keep a record of what was said. Don't go haywire with this newfound ability to communicate with others, but use it reasonably. In particular, don't send mail to large lists of people when you only really want to give the information to a subset of that list - it is very annoying to the others.

Getting help on computer commands

The unix system has innumerable commands, which makes it confusing. To help somewhat, it provides a short description of how to use each command, which is available on the computer by giving the command
man command-name
The command man gets its name because it is giving you pages of the manual. These descriptions are not usually designed for the beginner, but you should look at them anyway if you are having trouble with a particular command. Try man ls as an example to see both how to use man and how much you need to skip when doing so. If you don't know the command name, but have a good keyword, try the command apropos keyword. For example,
apropos fortran
will give you a list of relevant commands and files, some mysterious and some useful.

Some printed manuals can be found in the ARC terminal room and rooms 341, 383, and 241 in Serin. These are not to be removed, except for immediate Xeroxing and return. Some information is available on the computer in the directory /doc, but much of this is quite technical. In principle, simpler stuff should appear in /doc/physics/intro, but there is very little there yet except for a latex version of a previous version of this document.

This document is an effort to start a web-based help facility for our users. Information should be available about all the commonly used utilities on our Sun systems. What we have so far is here.

Other things

There are many other things you might want to learn about. It may be useful to know the names of a few of these things which might be useful. Some suggestions:

More detailed sources at Rutgers

More introductory documents on Unix are available at other Rutgers sites:

Basic Unix Commands.

Using Unix: The Introduction .

Using Unix: Intermediate.

Unix Software .


Please send any comments on this page to
Richard Vaughn
Last modified: Wed Mar 29 12:15:01 EDT 2006