Software for CSE 341
Compilers or interpreters for all of the languages we'll be using this
quarter should be installed on the undergrad computers on both Windows and
Linux. You can also download and install them on your own machine if you
have one. Specific directions for each language will be in the materials
for that language.
Using Linux and Emacs in CSE 341
Working in the CSE Labs
If you're going to use the lab machines, everything is set up for
you. If there is an application, simply search for it locally
(e.g. DrRacket, Emacs, etc). Otherwise, you will be able to compile/run the
necessary languages via terminal/command line. If you need
a refresher on terminal commands, see the "Basic Unix Commands" section.
The department also has a cluster of four linux servers for
instructional use known as attu. You can ssh
to attu.cs.washington.edu and be connected to one of the four
servers.
- To access attu from a Windows machine in the lab, go to Unix
Connectivity / ssh attu in the menu, and log in via the terminal.
This will set up the display correctly on your local windows machine.
(For example, if you run emacs on attu, it will pop up in a separate
window on your windows machine.)
- There is probably less reason to access attu from a linux machine in
the lab, since you're already on linux. But if you want to, open an
xterm, and give the command ssh attu. This alone won't set up
the display variables, so just run things that interact in the terminal
window.
Working elsewhere
It's also possible to work outside of the labs.
- Installing a particular piece of software is listed under a
particular language (e.g. "Running Racket"). Generally you should get the
latest stable release, although other recent versions should be OK as
well.
- If you want to run something on a department linux machine, use a
terminal and ssh to run Haskell, Prolog, Ruby, and Java. We recommend
using emacs as your editor for this option. (This won't work with Racket
though.)To ssh, follow the following instructions based on your machine:
- Mac/Linux:
- Open a terminal window, and run the following command, substituting your username for USERNAME:
ssh USERNAME@attu.cs.washington.edu
- Enter your password, and you should be logged in!
- Windows
- There's no default terminal that'll allow ssh'ing, so you'll have to download a package to do it for you. Here is a popular option:
Note that this will not allow you to launch GUIs (e.g. DrRacket) and
have it displayed on your computer. However, for the software for this course,
it will be sufficient to install GUI applications on your own machine, or
use the lab machines and just interact via the terminal window.
Basic Unix commands
To move around through the directory structure in your xterm window, you'll need to know a few basic Unix commands.
attu4% mkdir mydir
attu4% ls
mail mydir
attu4% cd mydir
attu4% pwd
/homes/iws/sbfan/mydir
attu4% exit
In the above (the things within the quotation marks are commands to type, don't type the quotation marks themselves):
To make a directory, and name it, say "mydir", you would type "mkdir mydir".
"ls" lists what you have in your current directory.
"cd" will change directories. To change to a directory "mydir", for example, type "cd mydir". To move back out of a directory, type "cd ..", and to get back to your home directory, "cd ~".
To check where you are, type "pwd".
"exit" exits.
To get help on some command, say you want to know how to use "ls", type "man ls" and you will get the manual pages for that command. (Alternatively, you can use "info" in the same way.)
These are just the very minimum basics, but you won't need too much
more in 341. For more info on UNIX, see the first few weeks of CSE 391 or this UNIX
tutorial
Accessing your UNIX home directories from Windows lab machines
If you're in the basement labs, your Z: drive should already be mapped to your Unix home directory. Look under for the Z: drive under "My Computer" in the Start Menu. All the files you saved while working on Attu should be there.
Emacs
To open emacs, open the application from the applications of the system or (if on xterm), run "emacs &".
- The cursor is a rectangular block and is referred to as the
point.
- The modeline displays information about the
buffer displayed in the current window. A buffer
is a logical "thing" that you are working on. When you open a
file, it will be loaded into a buffer, typically with the same
name as the file.
- Every buffer is edited in a mode. The most basic
mode is Fundamental, which provides only the most basic
Emacs editing features. There are modes for many different
languages.
- There are many "special" buffers that do not correspond to
loaded files. The one above is called *scratch*. This
buffer runs in Lisp Interaction mode, which means that
you can interactively type and evaluate expressions in the Lisp
programming language.
Emacs uses many key combinations involving the Control
and Meta keys. Such key combinations are denoted
C-x (Control-x (lowercase)) or M-x (Meta-x). On
keyboards that don't have Meta, Alt is usually an
acceptable substitute. If Alt doesn't work, ESC-x is equivalent
to M-x.
A sequence of key presses is written like C-a C-b M-x,
which would mean do the three actions in sequence.
The most important keys in Emacs
C-x C-c: Quits Emacs.
C-g: Cancels the current action.
C-x C-f: Opens a file.
C-x C-s: Saves a file.
C-x C-w: "Save as" (save contents to file
with a name you type).
Some other useful keys:
C-x 2: Split the window into 2 buffers, one above the
other. (Use the mouse or C-x o to switch between them.
C-x 0: Undo window-splitting so there is only 1 buffer.
C-x b: Switch to another buffer by entering its name.
C-x C-b: See a list of all current buffers.
Getting help within Emacs: In addition to the help button on the right...
C-h: Help. Hitting this will display a short message in
the minibuffer: C-h (Type ? for further
options).
C-h t: Built-in interactive tutorial. Some people don't
like this tutorial, but some people find it helpful.
C-h b: Key bindings. This lists all key bindings
that are valid for the current mode. Note that key bindings
change from mode to mode!
C-h a: Command apropos. After hitting C-h
a you can type a symbol and a window will appear that lists
all symbols and functions that match that phrase.
Finally, there are other resources, including the (older but not
necessarily outdated) course
help pages as well as the CS Lab pages.
Acknowledgment: These notes have evolved over many years, with
contributions from various TAs and instructors. The linux/emacs notes are
based on notes originally written by Keunwoo Lee in 2001. Last updated by
Daniel Snitkovskiy Spring 2018.