This is a quick guide to help you get started using linux/unix for cse 303. This includes setting up your shell, trying some basic commands, and dipping a toe into Emacs. We suggest that you use one of the instructional Linux or Windows machines. If you use Linux, you'll get an "xterm" terminal when you log in which you can use to execute commands, so skip to the "Basic Unix Commands" section. If you'd rather use Windows, the following sections will help you set up a terminal and an "X server" to make the Windows machines act somewhat like the Linux machines.
If you're going to be using the labs (such as AC 002), everything is all set up for you. Simply double-click the "SSH-X attu" icon on the desktop. A Reflection X dialog box may appear asking if you would like to run the 'Performace Tuner'. For now, just click 'No'. If you have never connected to attu.cs from the machine you are using, you will get a 'Host Identification' dialog box with some information about the security protocol (SSH) used to connect to this machine. Click the 'Yes' option. Type in your CSE account password when prompted and you're all set.
We need to do a little setup to make sure this terminal works the same way as a Linux xterm. First, go to the 'Edit' menu of the SSH window. Select the 'Settings' option. Select the 'Keyboard' subsection of the 'Profile Settings' on the left of the Settings dialog box. Ensure that both 'Use Alt as meta key' and 'Backspace sends delete' options are checked. Click 'OK' then save your changes by clicking the save icon or or selecting 'File->Save Settings'. If you do not save your settings, you will have to do this every time you log in. Saving the settings on one machine should affect all the Windows machines in the CSE labs.
Now look for the Reflection X icon in the notification area of the taskbar (usually in the lower right corner of the screen). The Reflection X icon looks like a little, teal pyramid with an "X" on it. Right click the icon and select 'Settings'. On the left side of the Reflection X Settings dialog box, scroll down to and select 'Keyboard'. Uncheck the 'Left' option in the 'Alt key reserved for Windows' section. Also ensure that 'Backspace key sends Delete' is checked un the 'Options' section. Click 'Apply' then 'OK'.
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.
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.
attu4% mkdir mydir attu4% ls mail mydir attu4% cd mydir attu4% pwd /homes/iws/sbfan/mydir attu4% exitEach line that starts with 'attu4%' (the prompt) shows the use of a different command. Anything that comes after a line on which a command was entered and before another prompt is the output from the previous command. In the above:
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.
Changing your shell for the time being: Type
attu4% bashNow you may have a different looking prompt (such as -bash-3.1$). 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.
Changing your shell once and for all: You could type bash every time you login, 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" 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. You might be asking, "What's the deal with th &?" Well, the & tells the program to run "in the background", which means, for our purposes, that we can keep using the shell while also using the program, emacs in this case. If you don't type the & you won't be able do anything in your shell. window.
Emacs uses many key combinations involving the Control and Meta keys. On keyboards that don't have Meta, Alt is usually used as a substitute. If Alt doesn't work, ESC is equivalent to Meta. When we were setting up Reflection X, above, we made sure that the Alt key was able to be used as the Meta key. Regardless of which physical key we use (an actual dedicated Meta key, Alt, or ESC), we refer to the key as Meta. Key combinations are denoted C-x (Control-x (lowercase)) or M-x (Meta-x, Alt-x if you've followed this guide, or ESC-x).
A sequence of key presses is written like C-a C-b M-x, which would mean do the three actions (Control-a, Control-b, Meta-x) in sequence. Some commands might involve keypresses with no modifier keys (Control or Meta), for instance C-x b RET (switch to the previous buffer) would be type Control-x then the 'b' key then the 'enter' key.
The most important keys in Emacs; get pretty colors (global-font-lock-mode)
~/.login. Built-in bash constructs like if and set should be in different colors. DO NOT edit this file unless you know what you're doing.
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. The notes were updated by Lincoln Ritter for autumn quarter 2006.