Cheat Sheet


CSE458 Course Web

http://www.cs.washington.edu/education/courses/458/CurrentQtr

Location of LA2

Rooms B015 and B025 in the basement of the Communications Building

Opening a Shell

When you log in you'll see a rectangular menu in the upper left corner of the screen (this is called the ToolChest). Use the left mouse button to click down on 'Desktop', then in the menu that appears drag down and release on 'Unix Shell'. You can have any number of shells open at the same time. Explore the ToolChest for things like customizing the appearence of your desktop.

The shell is where you'll start programs like Alias and Netscape, and where you'll check your mail and enter Unix commands. When you log in you'll also see a few icons along the right side of your screen. One is a folder with your login name on it. If you double click on it you'll see an icon interface to your files (and the entire directory structure, actually). You are on your own if you decide to use this interface. We recommend that you learn the Unix commands for file & directory manipulation since the TAs are all Unix proficient and ready to help.

Checking Mail

To log in to the UW computer where you have an email account, like Dante, enter the following at the prompt in your shell:

prompt% telnet dante.u

Logging in to the LA2 machines remotely

From a networked computer you can remotely log in to any of the LA2 machines. The names of the machines are: bobe, chuck, friz, max, otto, shawn, tex, walt. Here's how you'd log into max:

prompt% telnet max.animarts.washington.edu

Starting netscape, Alias, etc.

To start a program, open a shell and at the prompt, type the name of the program followed by an ampersand. The ampersand is not absolutely necessary; it starts the program in the background, which to you means that the prompt will reappear and you'll be able to start more programs from that shell. Start Alias and netscape like this (notice the captial 'A' in Alias):

prompt% netscape &
prompt% Alias &

Some programs, like StudioPaint and Composer, can also be started from the Utilities menu in Alias. And various programs can be started from the 'Find' menu in the ToolChest.

Making Backups

Each of the sgi's in LA2 has a DAT drive which you can use for backing up your work. The kind of tape these drives take is: '4mm-DL 90M'. You can get these at the University Bookstore Computer Store. We will do periodic backups of everything, so it's up to you whether you do your own backups.

You can use either tar or tapetool to do backups. Tapetool is essentially a visual interface to tar, and is recommended if you don't feel like reading the man page for tar. Keep in mind that tapetool creates a new archive file on your tape, overwriting anything previously written to the tape. Also, make sure that you do a listing of the contents of your tape after backing up because some of the drives are feisty and the backups are not always successful. Feel free to ask a TA for help doing backups.

Monitoring Memory and CPU

A couple of useful programs for monitoring usage of system resources are: gr_osview and gr_top (the underscore is part of the command name). Read the man pages on these applications to learn how to customize which resources they monitor.

Who's Online?

Type who at the prompt to see who's logged in remotely to your machine. There is also a script called WHO (yes, all caps) in the course home directory. Run it to see who's logged in to all the machines in the lab. There's a link to a script on the class home page that does the same thing.

A few more useful tips

Cut and Paste: Click down on the left mouse button and drag over some text, to highlight. This text, now stored in a buffer, can be pasted somewhere, like an emacs file or another shell, by clicking with the middle mouse button where you'd like the text to appear.

Command History: Hit the up arrow at the command prompt to step back through the history of commands you've entered. This is a quick way to enter a command that you've entered recently without typing it out.

Important Directories

/home/cse458/ This is the course home directory. Assignments will be turned in somewhere in here. See assignment handouts for details.
/usr/aw/3DCD/ Some cool shaders, models, etc. can be found here
/home/yourlogin/user_data/demo/ This is the directory in which Alias operates by default. You'll learn more about its subdirectories in a helpsession.

Basic Unix Commands

man commandname Learn everything there is to know about a command (all the options it takes, etc.)

File Manipulation

 
mv f1 f2 Move file 'f1' to new name 'f2'
mv f1 d1 Move file 'f1' into directory 'd1'
rm f1 f2 Delete files 'f1', 'f2', ...
chmod op f1 Unix files and directories each have permissions associated with them. These permissions are displayed when you do ls -l. You'll see a string of nine characters: rwxrwxrwx, where any of the letters might be replaced by a '-'. The first three letters are the read, write, execute permissions for the User, the next three for the Group, and the last three for the World. A dash in the place of a letter means that that particular permission is turned off. There are various ways to change permissions. You should read the man page on chmod to learn about them. Here is an example of using chmod:

Change the permissions on my home directory to be world readable:

First the permissions looked like this:
drwxr-x--x 26 katrin student 3584 Dec 31 14:55 katrin

Then I enter this at the prompt:

prompt% chmod o+r katrin

Now my directory is world readable:

drwxr-xr-x 26 katrin student 3584 Dec 31 14:55 katrin

"o+r" in the above use of chmod means "others can read". (Or, for example, "a+x" means "a+x" means "all can execute", and "g-w" means "group can't write".)
  

Directory Manipulation

 
pwd Pathname of current directory
ls d1 ls alone lists the contents of the current directory. If a directory 'd1' is specified, it lists the contents of that directory.
cd d1 Change to directory 'd1', where 'd1' is either a full or relative path name. '..' (two periods) stands for the parent directory, so "cd .." means back up out of the current directory.
mkdir d1 Make a directory named 'd1'
rmdir d1 Delete the directory named 'd1' if it is empty (all files have been removed with rm)
  

Process Manipulation

 
ps -u username List all the processes that 'username' (usually you) is running
kill pid Kill a process whose PID (process ID) you've determinded from a ps listing
kill -4 pid If your terminal freezes up because of Alias, the -4 option of killing it, by logging in from another terminal, attempts to save your work in a file called _m.saved
  

Checking Disk Usage

 
df -k See how much space is left on the different disks in the filesystem. The -k option gives the listing in terms of kilobytes rather than the default 512byte blocks. Here is an example of what you'll see on the LA2 machines:

prompt% df -k
Filesystem         Type  kbytes     use   avail %use  Mounted on
/dev/root           efs 2103546 1357543  746003  65%  /
winsor:/mnt/disk52  nfs 4083080 3500129  582951  86%  /mnt/disk52
winsor:/mnt/disk51  nfs 4083080 3744157  338923  92%  /mnt/disk51
winsor:/mnt/disk42  nfs 4061440 1881083 2180357  46%  /mnt/disk42
winsor:/mnt/disk41  nfs 4061440 2761329 1300111  68%  /mnt/disk41
winsor:/mnt/disk07  nfs 4327465 3283066 1044399  76%  /mnt/disk07
winsor:/mnt/disk03  nfs 1026171  618714  407457  60%  /mnt/disk03
winsor:/mnt/disk02  nfs 4327465 3990832  336633  92%  /mnt/disk02

In the above listing, disk51 is 92% full, and has a total capacity of about 4gig. About 3.7gig of that are in use, and about 340meg remain.
du -ks Summarize disk usage. The -s option, shows you only the grand total of the current (or specified) directory. Leave the -s out if you want to see the usage of each of the contents of your directory. The -k option gives the listing in terms of kilobytes instead of the default half-kilobyte (512 bytes).
ls -al List all of the contents of a directory (including hidden, dot-files) in long format (file size is displayed).

Examples of Unix Commands in Action

List the contents of a directory on the 3DCD
shawn ahp-74% ls /usr/aw/3DCD/pix/glass
glass_1 glass_2 glass_3 glass_4 glass_5
glass_1.ICON glass_2.ICON glass_3.ICON glass_4.ICON glass_5.ICON

Copy the file glass_1 to the current directory (indicated by the period)
shawn ahp-75% cp /usr/aw/3DCD/pix/glass/glass_1 .

List the contents of the current directory (which now contains the copied file)
shawn ahp-76% ls
glass_1

Create a new directory
shawn ahp-77% mkdir glass

Move the file glass_1 into the new directory called glass
shawn ahp-78% mv glass_1 glass

List the contents of the current directory. It only contains the directory glass since glass_1 was moved into glass
shawn ahp-79% ls
glass

Change directories to the glass directory and list the contents
shawn ahp-80% cd glass
shawn ahp-81% ls
glass_1

Check the current path
shawn ahp-82% pwd
/mnt/disk52/users/ahp/example/glass

Make a copy of the file glass_1 in the directory above the current directory
shawn ahp-83% cp glass_1 ../

Change to the directory above the current directory and list the contents
shawn ahp-84% cd ..
shawn ahp-85% ls
glass glass_1