Using Your Account
On math.hws.edu

The Department of Mathematics and Computer Science has a new server computer. (It's has two 400 MHz Pentium II CPU's and 256 MB of 100 MHz error-correcting RAM.) Computer science majors and all students in CPSC 124 and 227 will have accounts on this computer. The name of the computer is math.hws.edu. Your username is the same user name that you use on the Gulick lab computers and on hws3.hws.edu. A password has been assigned to you. (Contact David Eck if you don't know what it is, or if you forget it.) It will be convenient for you to change your password to the same password that you use on the Gulick PC's.


Using X-Win32

Logon Dialog Box The best way to access your account on math.hws.edu is with X-Win32, a program that is installed on all the publicly available PC's on campus. You should find this program from the "Start" button, in the "Program" section. When you run this program, you should see a dialog box asking for your username and password, as shown on the right. (Be sure to use your math.hws.edu password.) When you fill in the boxes and press return, an "xterm" window should open on the screen. This window is your connection to math.hws.edu. The window displays a prompt where you can type any of the commands discussed on this page. The first time you log on, you should probably change your password to the same password you use on the Gulick computers. Use the "passwd" command. Here is an xterm window that has just been used to change a password:


xterm window


X-Win32 pop-up menu If you don't get the xterm window, it is possible that you mistyped your password. To try again, click on the X-Win32 tab in the Windows control strip at the bottom of the screen. You'll get a pop-up menu that includes a "Sessions" submenu. Select "math.hws.edu" from the submenu, as shown in the picture at the right. This will open a new login dialog box. You can also use this menu at any time to open a new xterm window, even if you already have one opened.



In an xterm window, your interface to the computer is the bash shell. A shell is a program that lets you type in commands and carries them out. There are several shell programs available, but bash is probably the best of them. One of the nice features of bash is that you can use the up- and down-arrow keys to move through a list of commands that you have entered recently. This allows you to go back to a previous command, edit it if you want, and press return to re-issue the command. Another nice feature is file-name completion: Start typing the name of a file or directory, and press the tab key after you've typed a few characters. The name will be completed for you.

If you have a Windows PC connected to the campus network, it is possible to install X-Win32 on your own computer. Please contact David Eck if you would like to do this.


Files and Directories

A file is a named collection of information stored on a computer. A directory can hold files and other directories. All the files and directories on a UNIX system are contained in the so-called root directory, /, and its subdirectories. Every file has a full path name that begins with /, followed by the directories you have to go through to get to the file, followed by the name of the file. An example of a full path name is /home/eck/www/unixinfo/intro.html.

However, you don't usually need the full path name, since you are always in a working directory, and files in the working directory can be referred to by their names only. For example, if your working directory is /home/eck/www/unixinfo, then you can refer to the file /home/eck/www/unixinfo/intro.html simply as unix.html. When you first log in, your working directory is /home/username, where username is your user name. This directory is called your home directory. You can create files there, and you can create subdirectories to organize your files.

Here are some basic commands for working with directories and files:


Editing Files

You can edit files with the program "nedit". To edit a file, type the command

nedit filename &

in an xterm window. A separate window will open where you can edit the file. If the file doesn't already exist, you will be asked if you want to create it. The "&" at the end of the command is not required, but it is very useful. If you use the &, then you can click back to the xterm window and type in additional commands. If you leave out the &, the xterm window will be unusable until you have closed the editing window. Anytime you give a command that will open a separate window, it's a good idea to put a & at the end of the command.

The nedit program is a text editor, not a word processor. It doesn't have fancy fonts or formatting. It's mostly for writing things like computer programs. However, you should find it easy to use, since it uses the mouse and all the standard editing commands like Ctrl-V for "Paste." For programming, it has the advantage that it does "syntax coloring," which uses colors to help show the structure of a program.


Compiling and Running Programs

To run a program, simply type its name. Most of the commands that you use in UNIX are, in fact, programs. For example, the nedit editor is a program. When you type a file name, the shell will first look for the file in several default directories such as /usr/bin and /usr/local/bin. (You can look in these directories if you want to see some of the commands that you can use!) Then it will look in the current directory. You need to be aware of this because if you happen to use a name for one of your programs that is the same as a file in one of the default directories, you won't be able to run your program by typing its name -- the shell will run the program in the default directory instead. (However, you can always run the program by giving its full path name.)

To compile a Java program, use the command "javac filename" in an xterm window. The filename must end in ".java". If your program contains errors, they will be listed in the window. If they fill up more than one screen, you can view previous screens in the xterm window using shift-PageUp and shift-PageDown. (That is, hold down the shift key and hit the Page Up or Page Down key.) If you have the file open in an nedit window, you can click back and forth between the program and the error messages. Each error lists the line number on which the computer detected the error. The nedit command, CTRL-L, is very useful for going to a specific line in a file.

There are two types of Java programs: Applications and applets. To run an application, use the command "java classfilename", where classfilename is the name of the compiled .class file that contains the main routine. To run an applet, you need an .html file that includes that applet. You can run the applet with the command "appletviewer htmlfilename".

The computer math.hws.edu also has a C++ compiler. To compile a C++ program, use the command "g++ filename", where filename is a .cc file containing the program source code. This command will put the compiled program in a file named a.out. You can rename this file to something more meaningful.


Printing

You can print files from nedit using its print command. By default, this will print to the printer in room Gulick 208. (It is possible to change the default; ask me how if you are interested.) However, you can also print to other publically accessible printers. You need to know the printer name, which should be posted near the printer. The available printers are:

When you use the print command in nedit, you will get a print dialog box. Fill in the name of the printer that you want to use in the "Queue" box:

Nedit print dialog box

You can also print files by typing in a command in an xterm. The command is "lpr filename" if you want to print to the default printer. To print to a printer named printername, use "lpr -P printername filename".

It is not possible to print directly from Unix to a printer connected to your own computer.


Other GUI Programs

Besides nedit and appletviewer, there are lots of other programs on math.hws.edu that run in their own windows. There are a few game programs: ktetris, kasteroids, kshishen, ksame, kpoker, ksnake. The kvt program is an alternative to xterm that you might prefer, since it has a standard scroll bar. kmandel is for viewing the famous Mandelbrot set. kalendar is an appointment book. kcalc is a calculator. kpaint and gimp are drawing programs. Try them out if you like.


More Commands

The standard UNIX help system uses the man command (meaning "manuals"). To get information on a command, type "man commandname. For example, you could use "man nedit" to get information on the nedit editor. You will be reading the information as if with the "less" command, mentioned above, so you'll need to hit q to quit.

The command w -- just the letter w -- will output a list of the users who are currently logged on. The command "talk username" can be used to open a chat session with another logged-on user. When you give this command, the other user will get a message that you want to talk. (You can even use the talk command to talk to users on other computers on the Internet, including hws3.hws.edu. The "finger" command can be used to get a list of users logged on to another computer, provided it is implemented on that computer. For example: "finger @hws3.hws.edu".)

You can spell-check a file using "ispell filename" See "man ispell" for more information. The same program is used by the spell-check command in nedit.

You can suspend the current job that you are working on by typing Ctrl-Z (that is, hold down the control key and hit z). You can then give other commands. When you want to return to the suspended job, use the command fg. I am telling you this mostly because you might suspend a job accidently, and should know how to recover.

It is possible to save the output of a command in a file. Use the > operator. For example, "javac filename.java > errors" will run the Java compiler on filename.java. But instead of printing error and warning messages on the screen, it will write them to the file named errors. Be careful. If the file already exists, the old version will be overwritten. Similarly, it is possible to have a command read from a file instead of from user input. Use < instead of >. This feature allows you to write programs that use standard input and output, and then to use those programs to process files.

It is possible to send and receive mail in your UNIX account using the mail program called "pine". You could use this to send me mail, if you want, but you shouldn't think about using it for all your mail unless you are majoring in Computer Science and will have a permanent account. However, the same pine program is available on hws3.hws.edu. You can read about pine at http://www.washington.edu/pine/tutorial/index.html.


Accessing Your UNIX Account with Telnet

If you know how to use telnet, you can use it to access your account on math.hws.edu. However, you won't be able to use nedit or other programs that require their own windows. If you want to edit text files through a telnet connection, I suggest using the "joe" editor. Use the command "joe filename". A help feature is available when the program is running. You can also use the command "man joe" to get more information.


Accessing Your UNIX Account through Windows

Your home directory on math.hws.edu can be mounted on a networked Windows computer as a network drive. You can find it listed under the computer "math" which is in the "hwsmicro" workgroup under the "Network Neighborhood". You can also mount it by right-clicking the "My Computer" icon, selecting the "Map Network Drive" command, and entering "\\math\username" as the "Path" in the dialog box that pops up.

Once your home directory is opened under Windows, you can drag files back and forth between your Windows computer and your account on math.hws.edu. However, you should know that text files in Unix have a different format from text files in Windows. This will confuse some programs, including the Unix text-editor, nedit, and the Windows text editor, Notepad. However, the Java and C++ compilers will understand text files in either format. The Unix commands unix2dos and dos2unix can be used to covert text files from one format to the other.


Accessing Your UNIX Account through Appletalk

If you have a networked Macintosh, you can access part of your Unix account by mounting it on your desktop. To do this, you must create a directory called AppleShare in your Unix home directory. (Use the command "mkdir AppleShare" in an xterm window.) Only the contents of this directory will be visible on your Macintosh.

To connect from your Mac, first make sure that Appletalk is set to use Ethernet networking, not the printer port. (If you have a printer connected to your computer, you won't be able to use it until you reset Appletalk back to the printer port.) In the Chooser, click on AppleShare. You should see "math" in the list of computers. Double-click on it and connect using your Unix user name and password. Your AppleShare directory will be listed as "home@username".

Once your directory is mounted on your Mac desktop, you can drag files back and forth between your Mac and your Unix account. However, you should know that text files in Unix have a different format from text files in Windows. This will confuse some programs, including the Unix text-editor, nedit. However, the Java and C++ compilers will understand text files in either format.


David Eck, 4 September 1998