Quick & Dirty Guide to Getting Started in CSE 303
- We now suggest using WinSCP to transfer files between your computer
and the CSE Linux machines.
- We no longer ask you to run "xterm &" to get a shell.
Acknowledgment: These notes have evolved over the last few years, but
are largely based on notes written by Keunwoo Lee in 2001. They
started as a guide to CSE 341; information on SML has been removed.
They now include instructions on changing your default shell to bash,
which you should do for 303 unless you really do not want to.
We'll use Reflection X to give you a graphical interface for your Linux
session on Attu (attu.cs.washington.edu).
Logging in from the basement labs
If you're going to be using the labs, everything is all set up for you.
Simply click the Start menu (Windows icon), type "SSH-X attu" into the search box,
and hit enter. Say "Yes" to any prompt about public keys, type in your CSE
account password and you're all set. You now have a terminal (shell)
and can type commands.
We recommend you work in the basement labs where we have checked that
the right software is already installed and the directions we provide are
correct. If you still want to work elsewhere you have a few options.
You should test your homework on attu.
- Install the necessary software on your computer. Linux and
everything we will use in this course is freely available.
- Install Reflection X on your computer, using the CSE
department instructions. What a Reflection X session does is
connect you to a CSE Linux server. Everything you type or click is
sent to the server, which sends back to your computer what to display.
So you're using the department's software installation.
In addition to Reflection X, you may also want to install WinSCP. This will let you connect to a CSE Linux server,
such as attu.cs.washington.edu, and transfer files between
the server and your computer.
- For those savvy with terminals and ssh, it is possible to run
emacs and sml directly in terminals after connecting via ssh to the
department, but it is not particularly pleasant.
- You can change your desire to avoid the department labs.
Basic Unix commands
To move around through the directory structure in your terminal window,
you'll need to know a few basic Unix commands.
attu4% mkdir mydir
attu4% cd mydir
In the above (the things within the quotation marks are commands to type, don't type the quotation marks themselves):
These are just the very minimum basics, or course.
- 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.)
Changing your shell
The shell is the program where you type in commands. There are
different shell programs, which are all similar but have different
rules and features. For sake of uniformity, we will use a shell
called "bash" but it's likely that your account is set-up
such that when you create an terminal the shell it uses is
"csh". You can change this for the time being or
once and for all. We strongly recommend the latter, but we'll
explain the former first to help you understand what is going on.
For the time being: Type
Now you may have a different looking prompt (such as bash-3.00$).
Otherwise at this point you will not notice any differences, but
that's only because you don't know any differences between bash and
csh. When you type
you'll be back to the shell you were running when you typed bash.
That is, you started running a different shell and when you exited,
you just went back to the outer one.
Once and for all: You could type bash every time you create an terminal,
but that's a pain and you could get confused if you forget. So you
can tell the operating system once and for all that for your account,
the "first shell" for every terminal should be bash.
From any prompt, type:
chsh -s /bin/bash
You are running the "change shell" program and
specifying that your new shell can be found at /bin/bash. It's almost
As a final note, if your shell already is bash, chsh will just say
"Shell not changed."
- To be sure you have the right to do this, you'll be prompted for
- Before that, you'll be warned that typing passwords can be
dangerous. Say "y".
- As the message says, the change may take a few hours. In the
meantime, see "For the time being" above.
Now that you have your terminal open, let's open Emacs.
Type "emacs &" to open emacs in a new window. Note what happens
if you don't type the "&"--you can't do anything in your terminal
window. The "&" runs your program, in this case, emacs, in the
- The cursor is a rectangular block and is referred to as the
- 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
- 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.
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
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
Getting help in Emacs (the next most important keys)
- 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-h: Help. Hitting this will display a short message in
the minibuffer: C-h (Type ? for further
- 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.
- 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.
Font-coloring in Emacs
Remember the Emacs modes we were talking about earlier? The modes for
shell-scripting and C programming do a pretty good job of coloring
your code, but you may need to say you want that:
That's it. To check if it works, you need to restart Emacs. Save your
file (C-x C-s) and quit Emacs (C-x C-c), and open it up again. Open a
file that starts with
#!/bin/bash (or create one, close it,
and reopen it). Builtins like if and set should be in different colors.
Accessing your Linux home directories from Windows
If you're in the basement labs, your O: drive should already be
mapped to your Unix home directory. Look under for the O: drive under
"My Computer" in the Start Menu. To accesss your files, go to
O:\unix\homes\iws\userid, replacing "userid" with your own CSE account
username. All the files you saved while working on Attu should be
there. On some computers, the Z: drive maps to O:\unix\homes\iws\userid,
so you can also find your Attu files in the Z: drive.
If you're in the labs and your O: drive isn't mapped, open up a
Windows Explorer window (by clicking the "My Computer" from the Start
Menu) and in the Tools menu item, select "Map Network Drive" and enter
O: for drive and \\cseexec\cs for folder. Click Finish. If you're at a
computer that does not use CSE's name servers, for example in Mary
Gates Hall or at home, you will need to use the fully qualified name,
For more info on this, see the CSE support page that discusses Microsoft DFS, which is what we just used.
Finally, there are other resrouces, including the CS Lab and Support