["Accessing Linux" instructions revised 1/05/2008. HP]
This document is a set of basic instructions for getting a Linux prompt and
doing work in CSE 303. The home systems for the course are the instructional
Linux workstations in the labs and the server attu.cs.washington.edu
.
All of these machines share a common file system. It's easiest to work in
the basement labs where we have checked that the right software is installed
and
the directions we supply are correct. But there are
many ways to work from other machines, which are described below. In any case,
you should verify that your projects work properly on the lab machines
or attu
,
since these are the reference systems for the course and we will check your
work there.
The easiest way to go is just to use one of the Linux workstations. When you log in you will have a Unix shell and your current directory will be your home directory in the department's Unix filesystem tree.
You can use Reflection
X
on the lab Windows machines to
get
a
graphical
interface
for
your
Linux
session
on attu
. Simply double-click the "SSH-X attu" icon on
the desktop. Type in your CSE
account password and you're all set.
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 access 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.
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 \\ntdfs\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, \\ntdfs.cs.washington.edu\cs
.
For more info on this, see the CSE support page that discusses Microsoft DFS, which is what we just used.
Install Reflection X on your Windows computer, using the CSE department instructions. What a Reflection X session does is connect you to a CSE UNIX 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. If you don't want a full multi-window login session, you can use PuTTY by itself to open a simple single-window remote session and use it for your work.
If you've installed the cygwin package on Windows to get a full Unix-like
environment (see below), you can use its ssh
and scp
commands to get a basic
terminal connection that works the same as described below for OS X or Linux.
If you have a Mac there are two ways to connect to attu: either through a basic terminal window or with a full X-window interface.
The basic terminal window is simplest: start the mac Teminal application and
enter ssh
attu.cs.washington.edu
. This connects the terminal window to attu
and
everything you do will run in that window, including things like emacs.
To get your work done, you may well have to bounce back and forth in this window
between different programs like emacs and the shell.
You can also get a full X-windows interface, the same as that provided by
the Reflection X package on Windows. For this, you first need to be sure that
you've installed the X11
program, which is Apple's version
of X windows. This is an optional installation package that you can find on
the
system disks that came with your Mac or with your OS X upgrade. Once it is
installed, run the X11
application, which is in Applications>Utilities. X11
should
pop up an xterm
window (something different than the regular Mac
terminal program). Enter ssh -Y attu.cs.washington.edu
to get
a full X-windows session on attu
. Depending on your network
connection, this might, or might not, be acceptably quick and responsive.
Regardless of whether you are using the OS X Terminal application or X11's
xterm
, you can use the scp
command to copy files back and forth between your
local Mac disk and the attu
filesystem.
If your remote machine is running a reasonably current Linux distribution
you can use ssh
in a terminal window to connect as described for
OS X above. Simple ssh
will give you a single terminal window
interface; ssh
-Y
will give you a full X-windows connection. You
can also use scp
to
copy files between your local machine and attu
. You should not
need to do anything extra to install X windows on most Linux distributions.
While you can do all your work connected to attu
, sometimes this
is not possible, or is not convenient because of slow network connections or
other issues. There are versions of bash, emacs, gcc, etc. for other systems
that you can use. However, you should double check your work on attu
before
you submit it, since there are sometimes subtle differences between versions
of the GNU tool chain installed on different systems.
attu4% mkdir mydir attu4% ls mail mydir attu4% cd mydir attu4% pwd /homes/iws/sbfan/mydir attu4% exitIn the above (the things within the quotation marks are commands to type, don't type the quotation marks themselves):
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 log in 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
attu4% bashNow 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
bash-3.00$ exityou'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 xterm, 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 xterm should be bash. From any prompt, type:
chsh -s /bin/bashYou are running the "change shell" program and specifying that your new shell can be found at /bin/bash. It's almost that simple:
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 xterm window. The "&" runs your program, in this case, emacs, in the background.
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; get pretty colors (global-font-lock-mode)
#!/bin/bash(or create one, close it, and reopen it). Builtins like if and set should be in different colors.