UNIX, Emacs, and Scheme Tutorial

Spring 1995


Part 1


We shall be using the computer named copper, which runs the UNIX operating system. Use your network ID (your username) to create a copper account following directions provided by UCS. You can connect to copper from any microcomputer cluster, or from a home computer via a modem.

This tutorial provides a basic introduction to the software tools we suggest you use in this course. Read this material through first and then try out the instructions on the computer. Refer back to this material when necessary throughout the course. If you need help, ask a consultant or any of your instructors to show you how. Play some with the computer outside the requirements of the course. It's fun and will make you more comfortable with the software required by the course.

UCS provides many handouts to help you learn about the computing environment at IU, and they offer classes to help you get started with computers. Below is a list of pamphlets you might want to look at.

This list is by no means complete; so look over other UCS handouts as well.

Getting Started

Logging In

You can log in to copper from any machine in a UCS cluster, or any other machine on IUBnet (the Bloomington campus network), including telephone modem access. Since PCs and Macs are the most common, this tutorial will give instructions using these microcomputers. For help logging in from somewhere else, talk to a UCS consultant or one of your instructors.

In this tutorial we explain what we believe to be the simplest and generally most satisfactory ways of accomplishing things, but there are usually other ways to do the same thing. For example, on UCS PCs telnet can be accessed from Windows as well as the menu access we describe below. In Windows the telnet font is smaller, but it is possible to switch to other Windows applications, such as Mosaic, without leaving your telnet session.

You are encouraged to explore the wondrous complexities of our software environment, and in the process you will doubtless discover other approaches that you prefer at least some of the time. As in all things, this exploration should be pursued in moderation--don't neglect other aspects of life!

From a PC

The UCS PCs initially present you with a menu-driven interface (providing the last user bothered to exit fully). You should become comfortable with moving around within their menus. The menus are organized hierarchically. To move toward the top-level menu, called the "Main Menu", hit the ESC key.

Using the up or down arrow keys in the main menu, highlight the Communications option, and then hit the Return or Enter key, hereafter indicated by <CR>. You will see another menu. With the arrow keys, move to the first telnet option and select it with <CR>.

Now you will see a box in which you are asked for the name of the computer you wish to log into. Type copper<CR>. The telnet screen appears next with the login prompt.

Skip the following Macintosh information for further instructions.

From a Macintosh

Double-click the mouse on the filing cabinet named MACINTOSH in the upper right of the screen (unless this window is already open). You will see a window containing many folders with names under them. Double-click the mouse on the folder called Communications.

Now you will see a collection of odd-looking icons, with one named copper; double-click it. The Telnet program will start up in a new window with the login prompt.

After starting Telnet

The login prompt asks for your username. After entering your username, and <CR>, you are next prompted for your password. Your password will not show up as you enter it. After entering your password, you must also enter <CR>. Since you must almost always press <CR> after entering something, we won't mention <CR> again.

If you receive an Incorrect Password error, try typing your username and password again, slowly and carefully. If repeated attempts fail, see a consultant.

Once you've successfully entered your username and password, the computer prints out a welcoming message and gives you the UNIX shell prompt copper ~>. (The ~ indicates you are in your home directory. The prompt will be modified accordingly if you move to another directory.) At this prompt you may enter any UNIX command.

Logging Out

It is very important that you log out of your account when you are done using the computer, or if you leave the computer unattended. Failure to do so allows others to look at and and possibly damage your private files, to misrepresent you to others (by sending e-mail from your account), and to gain access to other computer systems on which you have accounts. To log out, enter the UNIX command logout.

On the PC you will be returned to the Communications menu, on the Macintosh you will be left in the Telnet program and then need to select Quit from the File menu to exit the telnet program.

Getting Help

We will be using a number of UNIX programs, and you may have questions about some of these that we have not anticipated. A useful tool for getting help is the man (short for manual) command. For example, to see documentation on the ls command, enter the command man ls. The emacs editor has its own built-in tutorial and help system, which we describe below. You may want to go through some of the on-line tutorial that is built into emacs to get a broader picture of what it can do. Emacs is an extraordinarily powerful editor; we only touch on its capabilities in this tutorial.

Brief Overview of UNIX Commands

The UNIX commands introduced here will help you to look at what you've done, to change it, and to delete it. You may want to look at a copy of UCS's UNIX guide which provides a more extensive introduction to the vast array of UNIX commands. Read this section through, then finish the tutorial and come back. By then you will have created some files that you can manipulate with the following commands.

UNIX commands may only be entered at the shell prompt. If a typing mistake is made, it can be erased with the Delete key. Each time you press the Delete key, the cursor moves one space to the left, erasing the character in that space.

Listing Files

You start out in your home directory. To see what files are in the current directory, use the ls command. Try it and you will see something like:

copper ~> ls
Your home directory comes with an empty bin directory, that you will have no need for in this course. For now just keep it simple by staying in your home directory. After you've finished the tutorial below, try this command again. By then you will have created more files in your home directory.

There are a few more files in your account. These are "dot" files which contain information to configure your account. To see these files, you type

copper ~> ls -a
You will see a number of files such as .login and .profile. Do not delete any of these "dot" files.

Copying Files

Now to copy the file .login to a file named test1.txt, type the following at the prompt:

cp .login test1.txt
You can name the copy anything you want, as long a name as you want. (Any letter or number may be used in a UNIX name, as well as some special characters such as dot. UNIX, unlike some other operating systems such as DOS, is case sensitive: upper and lower case versions of the same letter are considered to be different. You should try to keep the extension after the dot the same, since that tells you what kind of file it is. Scheme files generally end in .ss and text files often end in txt. You can see if the copy was made by entering the command ls. cp does not remove the original file.

To try this on your own, copy the file test1, which you just created, into a file test2.txt. When you type ls, you should see three file names: bin, test1.txt, and test2.txt.

Moving Files

Use the command mv move a file from one directory to another, or just change the name of a file.

mv test2.txt test3.txt
Now there should be no file test2.txt, and a new file test3.txt that is exactly what test2.txt was.

Deleting Files

Delete files with the command rm, short for "remove":

rm test3.txt
This deletes the file test3.txt from your directory. Be very careful when using this command; you may not be able to get the file back if you delete it accidentally.

Viewing Files

To look at what is in the file test1.txt, you can type

more test1.txt

cat test1.txt
The first shows you the contents of the file, one screenful at a time. Press the space bar to go from screen to screen. Hit return to move down one line at a time. Type q to quit (get back to the shell prompt) before the end of the file. cat scrolls through the whole file without stopping.

Printing Files

Many clusters have line printers that are accessible from copper. The name of the line printer is usually indicated on a label taped to it. If you must use a laser printer, you can access the printer in LH004 by the name cs_ps10. You should only print to that printer when you are in one of the microcomputer clusters in Lindley Hall (the machines in LH004 itself require a different computer account). You may also "download" the file you want to print onto the microcomputer you are using and then print it out on the cluster laser printer. Ask a consultant for help if you don't know how to print from a particular cluster. If you are printing directly from copper, use the following commands:

To print a file to a given printer, say cs_ps10, use the lpr command with the argument -Pcs_ps10. For example, to print text1.txt to the laser printer in LH004, type:

lpr -Pcs_ps10 save.txt
Sometimes many people print files at the same time. You can look at the list of files waiting to be printed using the command:

lpq -Pprinter-name
If you are picking up your printout immediately and the printer is not busy, you use the -h flag, which tells the printer not to print a header page with your name on it:

lpr -Pprinter-name -h filename
If you change your mind about printing a file, and it has not started to print, you can use the command lprm to remove it from the queue of files. Use man lprm to find out more about it.

Using Scheme

To start Scheme from the shell, just use the command scheme (If you have much to do in Scheme, we suggest you run it in emacs instead. We'll get to that presently.) Scheme greats you with a message identifying itself and then the Chez Scheme prompt >. At the Scheme prompt you can enter any Scheme expression. For example
copper ~> scheme
Chez Scheme Version 4.1b
Copyright (c) 1991 Cadence Research Systems
> (+ 3 4)
When you press <CR>, Chez Scheme's read-eval-print loop evaluates the expression and prints the answer 7. Then you again get the prompt >. Enter 'cat, making sure you type the apostrophe before the word cat. Chez Scheme returns cat and then prompts with >. Chez Scheme is case insensitive. Regardless of whether quoted variables are entered in upper- or lower-case letters, Chez Scheme returns them in lower-case letters. Now enter 15 and we see that 15 is returned. Numbers need not be quoted when they are entered; they are self-evaluating. The symbol cat is not self-evaluating: we had to quote cat in order to have it interpreted literally as the symbol cat. Now enter cat without the quote. You get a message which tells you that the variable cat is not bound (don't worry about the "debugger" information for now, every error causes that to appear). cat, unquoted, is a variable that has not yet been given a value.

Now observe the results of entering each of the following expressions in response to the Scheme prompt. Can you explain the results in each case?

(cat dog mouse)
'(cat dog mouse)
(+ 1 2 3 4 5)
'(+ 1 2 3 4 5)
'(car '(one two three))
(car '(one two three))
(cdr '(one two three))
(cons 'one '(two three))
We exit from Scheme and return to the shell prompt by responding to the Scheme prompt with

> (exit)
or by typing C-d. (This is our notation for control-d; hold down the control, or ctrl, key while pressing the d key.)

The Emacs Editor

In the above exercises, you entered the expressions while Scheme was invoked from the UNIX shell. Once you entered an expression and it was evaluated, there was no way to get it back to change it, or to save it to a file for later work. It is usually more convenient to enter expressions in an editor and then transfer them to Scheme for evaluation. This allows you to keep a permanent record of what you write by storing the expressions in a file in your account. We suggest using the emacs editor. It is very powerful for program development and many other uses, it is widely available, and it allows Scheme to be run within the editor. To see how this is done, enter the command emacs at the shell prompt. For example

emacs test.ss
Given emacs a filename argument, such as test.ss causes emacs to load the given file for editing if it exists, or start a new buffer for creating the file if it does not exist.

You will now see a blank window with the cursor at the upper left corner and a banner at the bottom displaying Emacs and some other information such as (Scheme), indicating that the editor is in its Scheme mode.

Now type

(car '(one two three))
again and observe that when you close each pair of parentheses, the cursor bounces to show you the matching opening parentheses. The expression is not being entered in Scheme itself, so you will not see the result of its evaluation, but it can be sent to Scheme at any time, as we shall see. Press DEL (the delete key) and notice what happens: it erases the character to the left of the cursor.

We shall next learn to use the editing commands of Emacs. In Scheme mode emacs bounces the cursor for parenthesis matching and some other tricks that are great for Scheme programming, but not when you are typing prose (say in English). For that you want to be in text mode. We switch from the Scheme mode to text mode by pressing ESC (the escape key), releasing it, then pressing x. Note that M-x appears at the left end of the banner at the bottom of the screen. Now type text-mode<CR>. In the future, typing such as sequence will be indicated by M-x text-mode. (M-x is read "meta-x". On some keyboards M-x may also be entered by holding down a meta or alt key while pressing x.)

Notice that now the word (Text) appears in the banner at the bottom of the screen. When you call up Emacs with a filename ending with the extension .txt, Emacs goes directly into Text mode, whereas when the filename has the extension .ss, it automatically goes into Scheme mode.

When entering emacs command names after the M-x (read "meta x") prompt, you can hit the space bar to cause Emacs to show you all the current completions of the command you are entering. This can save you from typing the whole command.

Getting Help

The command C-h (control-h) invokes the emacs help facility. Type C-h again for a brief list of help options, or a third time for a full page description of help options. As always when emacs is prompting for more input at the bottom of the screen you can abort the command that is prompting for information by typing C-g.

Moving Around

Now type a few lines of text. To move the cursor up, press C-p, (p for "previous"). Repeat this until the cursor is on the first line of your text. Press C-n to move the cursor down again (n for "next"). Move the cursor up again to the first line of your text. If it is not at the beginning of the line, press C-a. Now press C-f and note that the cursor moves "forward" one space. Next press C-b, the cursor moves "back" one space.

To move forward over one word, use the command M-f. (Recall this is read "meta-f" and may be entered by pressing ESC and then f.) Next try M-b and watch the cursor move backward one word. You can abort a command or sequence of keystrokes with C-g. For example if you have typed ESC, but then decide that you want to move forward a character, enter C-g to abort the ESC keystroke, and then enter C-f. Try it.

Now enter C-e. The cursor moves to the right end of the current line. Entering C-a moves it back to the beginning of the current line. Two additional commands that you will find useful are C-v which moves ahead to the next screen and M-v, which moves back to the previous screen.

Deleting Text

We saw that DEL deleted the character to the left of the cursor. Now press C-d and note that the character directly under the cursor is deleted. Retype the letter that was deleted. Now press C-k. This deletes (kills) whatever is to the right of the cursor on that line and stores it in a "kill buffer". If you press C-y, the last thing stored in the kill buffer is copied into the position starting at the cursor. Try it.

Saving a File

Observe that there are two asterisks (stars) at the left end of the banner. These indicate that the buffer you have been working in has new material that has not been saved to a file. To save what you have done in a file called mytext.txt, enter C-x C-w (control-x followed by control-w, the "w" stands for "write file"). You will see a prompt in a mini-buffer at the bottom left of the screen under the banner asking for the name of the file. Type mytext.txt and wait until a message is displayed in the mini-buffer indicating that the file has been written. After it has been written, the two asterisks disappear. Note that the filename with its extension appears in the banner line just after the word Emacs:. If you want to save the buffer to the same filename, you can enter C-x C-w and then <CR> instead of typing a filename. If you are using a PC and not a Mac, you can also save a buffer to a file using C-x C-s, which saves the buffer to the current filename. On the Mac, C-s causes the whole Telnet window to pause, and you must hit C-q to get it going again.

Inserting a File

The command C-x i is used to insert the contents of a file at the current buffer position. It prompts for the name of the file to insert using the mini-buffer, in the same manner as the C-x C-w command. Trying this now using the file you just saved will give you two copies of your material in the buffer.

Undoing Mistakes

If you make a mistake, such as accidentally deleting text, you can undo it with the command C-x u. This is particularly handy if you accidentally type a control-key combination that you have not learned and it does something completely unexpected!

Running Scheme in Emacs

You can run Scheme within Emacs directly with the command M-x run-scheme. This creates a buffer in which Scheme runs directly, and you can use Scheme just as you would outside of Emacs.

Sending Mail

To send mail from within emacs, enter C-x m. A new buffer will appear with the cursor after To:. Enter the email address that is to receive your mail on this line (or multiple addresses separated by commas). Enter a brief description of your message following Subject: on the next line. Then move the cursor to the end of the buffer and compose your message. When you are ready to send the message, enter C-c C-c. It will be sent and the buffer will disappear. We will discuss receiving mail in Part 2. We shall also describe the use of the Elm mailer which you may find simpler to use.

Exiting Emacs

To quit Emacs, enter C-x C-c. If there are unsaved files or sub-processes (like Scheme) running you will be prompted to decide what to do with them. Be careful to save any work you want to keep.

Below is a summary of the Emacs commands used in this tutorial. You will have a chance to use them in the assignment which follows the summary.

Summary of Selected Emacs Commands

Move cursor Forward one character. May use right arrow key.
Move cursor Backward one character. May use left arrow key.
Move cursor down to Next line. May use down arrow key.
Move cursor up to Previous line. May use up arrow key.
Move cursor to End of line.
Move cursor to beginning of line.
Enter the Emacs help facility.
Delete the character before the cursor.
Delete the character at the cursor.
Kill the rest of the line from the cursor to the end of the line.
Unkill (restore) the last thing killed.
Display the next screen.
Display the previous screen.
C-x C-v
Load a new file into the current buffer. Prompts for a file name.
C-x C-w
Write the whole buffer to a file. Prompts for a file name.
C-x i
Insert file. Prompts for the file name.
C-x u
Undo the last text modification.
M-x run-scheme
Run Scheme in its own emacs window.
M-x text-mode
Enter text mode.
M-x scheme-mode
Enter Scheme mode.
M-x shell
Start a UNIX shell in an emacs window.
C-x m
Send an email message.
C-x C-c
Exits from Emacs.
As time goes on, you will probably want to become familiar with more Emacs commands to speed up your work and allow you to do more things. There is a more complete GNU Emacs Reference Card available from UCS.

Part 2

The first part of this tutorial acquainted you with the basics of the Emacs editor. We now introduce some additional emacs commands and and more information on the use of emacs to write and test Scheme programs. After that, we give a brief introduction to the Elm mail reading program and the Mosaic Web browser. You can also accesss the course newsgroup through Mosaic.

Scheme programming in Emacs

When editing Scheme programs, you always want to be in Scheme mode. We have seen that this happens automatically if you visit a file with the extension .ss, or you can switch to Scheme mode at any time using the command M-x scheme-mode. There is no Scheme prompt in Scheme mode, since we are simply editing text that will later be sent to Scheme. Let's start by typing
(define cat 'cheshire) 
When you typed the right parenthesis, it bounced back and matched the left parenthesis. In this way, you will always be able to tell which pairs of parentheses have been properly closed. At this point, let's save the Emacs buffer to the file pets.ss by entering C-x C-w. You can tell that it has been saved by noting that the two asterisks are no longer at the left end of the banner line.

Using Two Buffers

We want to start up a Scheme process within Emacs, but we also want to be able to see our original file. We can do this because Emacs allows us to view more than one buffer at a time. Type C-x 2, and watch what happens. We now have two buffers on the screen. When we move our location in one, the other stays the same. You can switch between buffers using the command C-x o (for other buffer). Move back and forth a few times, and try moving the cursor in one buffer and not in the other.

To start up a Scheme process in one of the two buffers, enter M-x run-scheme. We should now have our file pets.ss in one half of the screen, and Scheme in the other. This is probably the way in which you will prefer to do your work. Try switching between the Scheme buffer and the file buffer using C-x o.

We load the file pets.ss into Scheme by typing the expression (load "pets.ss") at the Scheme prompt. This causes Scheme to read and evaluate the expressions in the file just as if they had been typed in at the prompt. We call this loading the file. Now enter cat in response to the Scheme prompt. (Do not quote the symbol cat this time.) Instead of a message indicating an unbound variable, cheshire is returned. We have bound the variable cat to the value cheshire and when Scheme evaluated the atom cat, it returned its value.

Now to get back to the file pets.ss, type C-o again. Use C-n or the down-arrow to skip a line below what has been typed, go to the beginning of the following line and then type

(define dog 'beagle) 
Save the buffer again using C-x C-w and return to Scheme using C-o. In order for Scheme to know the new definition, we must load the file again. You may load the file pets.ss again by either typing the statement again, or by using the arrow keys to move up to the previous line where you loaded the file. Move the cursor to the end of the line (did you remember C-e?) and then press <CR>. Emacs should have copied the load expression to the last prompt, causing Scheme to evaluate the load expression again, just as if you had typed it again. Respond to the Scheme prompt with dog. We get the answer beagle. Now go back to the pets.ss buffer using C-x o.


Emacs will automatically indent Scheme expressions to make them easier to read. This indentation is accomplished by using the <CR> key, so when you enter an expression that spans more than one line, it will automatically indent the new line appropriately. On the next line, type

(define couple 
  (cons cat (cons dog '())))
and watch carefully how the second line was indented and how the parentheses match as each pair is closed. When typing expressions into Scheme directly (within Emacs), the expressions will also be indented. The Tab key may be used to re-indents the current line if the indentation is not right.

Now save the file, return to the Scheme buffer, and load the file pets.ss. When you get the Scheme prompt, enter couple. You should get the answer (cheshire beagle). Now while in Scheme, enter

> (cons 'a couple) 
and you get the answer (a cheshire beagle) (What happens if you now type couple again?). Now kill the Scheme process by entering (exit). To get rid of the empty buffer on the screen, change to the other buffer with C-x o and type C-x 1 which will make the current buffer the only one on the screen.

We now return to Scheme to make a point. Type M-x run-scheme again. When you get the Scheme prompt, >, enter cat. You get an error message since the previous Scheme process was terminated and the variable cat is not bound to a value in the current process. Next enter

> (load  "pets.ss")
If we now enter cat, we get the answer cheshire.

Editing in Scheme

We next look at a few features of Chez Scheme within Emacs that we have not yet discussed. Enter the following code after the prompt.

> (define mylist
    (cons 'one
          (cons 'three
                (cons 'five '()))))
If you type mylist in response to the next prompt, you should see the list (one three five). Now press the up-arrow key enough times to get back to the definition of mylist. Using C-p, move the cursor up to the end of (cons 'one. Press C-o. This opens up a blank line below the line (cons 'one. You move to the beginning of that blank line by pressing C-n and pressing Tab will move the cursor under the ' in 'one. (You may also use C-j to open a new line and move to the correct indentation automatically). Now type (cons 'two. We move to the next line using C-n and re-indent the line using Tab. Pressing the space bar to add spaces moves the line to the right, but Tab or DEL will bring it back. Now move to the next line and edit the 'five to be 'four and indent the last line to be correct (go to that line and hit <TAB>). You also have to add one right parenthesis at the end of the last line to close all of the parentheses. Your screen should now look like this:

> (define mylist
    (cons 'one
          (cons 'two
                (cons 'three
                      (cons 'four '())))))
With the cursor at the end of the last line, press <CR> to evaluate this expression. Now type mylist and you should see the answer (one two three four). This exercise was designed to show you how to edit in Scheme itself instead of going into an Emacs buffer. The commands for moving around in both are essentially the same, when Scheme is run within Emacs. When Scheme is run outside of Emacs from the shell prompt, it does not have any fancy editing commands.


We can also move the the code we enter at the command line to a file. Press the up-arrow key enough times to get back to the last definition of mylist. Set the cursor at the beginning of the expression and press C-@. Mark set should appear at the bottom of the screen. If that doesn't work, M-x set-mark will.

n Now move the cursor to the end of the expression, and press C-w. The lines between where the mark was set and where you pressed C-w should disappear, but they are not gone forever. They are in something called the Kill Buffer. If you now type C-y (yank from kill buffer) the lines will be restored.

Now go to the other buffer, pets.ss, and position the cursor at the bottom of the file. Press C-y again, and another copy of the expression will appear. You may copy expressions either way using this method, from one buffer to another, from Scheme and to Scheme, and within one file. This is analogous to the cut and paste operations many word processors provide.

We are now finished, and you may exit Emacs by typing C-x C-c.

Reading Mail

To read mail in Emacs, use the command M-x rmail. A new buffer pops up displaying your first email message, and you are in rmail mode. In this mode many keys, including the normal letter keys, invoke commands special to rmail mode. Space and DEL scroll the current message down and up, respectively. n and p move to the next and previous messages, respectively. d deletes the current message. q saves undeleted messages and exits rmail mode. C-o prompts for a file name and the current message is saved in the named file.

r replies to the current message, popping up a new buffer to compose the message. This is similar to C-x m, but the To: field is filled in for you and when the cursor is positioned in the body you may use C-c C-y to yank the message you are replying to into the current buffer with some indentation.

In any emacs mode (so far we have introduced Scheme mode, text mode, and rmail mode), the command C-h C-h m may be used to display in a separate buffer a summary of all the mode-specific commands.

Summary of New Commands

In Emacs

Go to next line and indent a Scheme expression (in Scheme mode).
Opens a blank line below the current line.
Indents a Scheme expression without the newline (in Scheme mode).
C-x 2
Split the window into two buffers.
C-x o
Move the cursor to the other buffer.
C-x 1
Make the current buffer the only buffer.
Set a mark: a place from which to cut or copy.
Cut the marked text and put in the Kill Buffer.
Yank the Kill Buffer to current cursor position.
C-x C-z
Pauses to shell. Return to Emacs by entering fg.
C-h C-h m
Lists mode-specific commands.
M-x rmail
Read email. Rmail mode commands follow:
Scroll to next screen of this message.
Scroll to previous screen of this message.
Next message.
Previous message.
Delete the current message.
Reply to this message.
Save this message. Prompts for a file name.
Save undeleted messages and exit rmail.

In Scheme

(load "filename.ss")
Reads and evaluates the expressions in filename.ss.
Terminates the current Scheme session.

Using the World Wide Web

Mosaic is the most popular browser for the World Wide Web (WWW). To access Mosaic from a UCS PC, first start Windows by selecting the first item on the Main Menu, then double click on the Mosaic program group, which opens a window with the Mosaic icon, and then double click this icon. On a UCS Macintosh the procedure is similar: double click on the Mosaic folder to open it and then double click on the Mosaic icon within the folder.

Either way, Mosaic starts by displaying the IU Bloomington home page. Under the heading On the IUB campus the item List of all IUB departments, units, and divisions is underlined. This means it is a WWW link to another page of information. Just click on a link to follow it. Try this one. A new page appears with a list of items, one of which is Computer Science. Click on it to brings up the Computer Science Department's home page. Follow the Courses link and then the C211 link to bring up the home page of this course, which was passed out in hard-copy form on the first day of class as the course description.

If you know the Universal Resource Locator (URL) of a page, you can jump to it directly at any time you are running Mosaic by pulling down the File menu and selecting Open. This pops up a window in which to enter the URL. The URL of the C211 home page was given in the course description. Next time you can use it to avoid the long navigation outlined in the last paragraph.

Generally clicking a link calls up another mosaic page, though some links have other behavior such as displaying a simple text page or a directory structure, or perhaps starting a postscript file viewer or a newsgroup viewer. If you have followed a link to a page and want to return to the original page, click on the left arrow or Back button at the top or bottom of the Mosaic window.

You might like to access the WWW from home with a modem connection, rather than the high-speed network connection provided all UCS microcomputers. This is possible using the UNIX command lynx while logged into a UNIX machine using a standard terminal emulator. Lynx does not support color and graphics as Mosaic does, but it provides basic Web browsing capability.

Reading Newsgroups

The UNIX world has newsgroups, similar to VMS Notes and PC bulletin boards, for group communication. There are many newsgroups that you may be interested in if you have the time, but for the purposes of this class you will only need one, ac.c.211. It serves as a forum for you to ask questions of each other and of the instructors, make comments about the class, and receive information from the instructors.

You can access our class newsgroup from WWW by calling up the C211 home page using Mosaic and first selecting Communications and then selecting ac.c.211. This may be the most convenient way four you to read our newsgroup. You may also use the newsgroup reader trn by using the UNIX command

trn -q ac.c.211 
If you want to browse through other newsgroups, just enter trn. Some other local groups you may be interested in are cs.general, cs.students, and iu.general. There is a protocol to posting articles to non-class newsgroups. You should subscribe to news.announce.newusers and read it before posting anything outside of our class newsgroup.

Trn asks you several questions. If you are in doubt, or do not remember what to do, type h for "help" and trn will show you a list of commands and a short description. Trn will pick a default action if you hit the space bar, which is often what you want.

When you enter a newsgroup you are often shown a list of threads which are postings that share a common topic. Most of the time you will just want to hit the space bar to be shown the articles that you have not yet read.

While you are reading an article, hit s and then enter a file name to which the article will be saved. It is saved in a directory named News; to save it in another directory, you should give the path to that directory. For example, to save it in your home directory, type s ~/welcome.txt. Try this, then exit trn by typing q several times.

Often you may wish to go back to an article that you previously read. By default, trn only shows you articles you haven't seen yet. To reread a message, enter the newsgroup (even if there are zero unread articles), and then use P and N to move backward and forward among the unread article (P for "previous" and N for "next"). Lower-case p and n will also move you backward and forward among articles that you haven't read yet. You can also type the number of the article you want to see; the number is shown at the top and bottom of each article. You can get an index of all articles that were posted in a newsgroup by typing U when you get the prompt [npq]. You get another prompt [+tsan] to which you respond with a +. This produces the index of all articles. You can get more details about using trn by reading the man pages for trn.

If you want to post a reply to an article, you may type f while reading an article in the right newsgroup (f stands for "followup"). You will be prompted for a subject for your article, and then asked for a "Distribution". That will tell trn how far you want your message to be sent. You should always type iu there when posting to our newsgroup. That will make sure that your message doesn't go to a newsgroup with the same name somewhere in Australia. Answer the rest of the questions. When asked what editor to use, you may type emacs. When you are done editing your message, save it and exit from the editor. If you are sure that you want to post; type send. If you are outside of trn you can post a message by sending an email message to the name of the newsgroup.

Using Elm To Read Mail

Completing the trio of system software you will be using in this course is a mailer program. There are several mailers, e.g., mail, mush, mh, pine. Some such as rmail, mh-e and vm can be run under Emacs. Elm is a mailer that is simple and easy to use. The following section gives a brief introduction to elm. [Note: as with all other software running under Unix check the man pages by typing a "man elm" at the Unix shell prompt to get more information about elm.]

After starting elm you will be presented with a list of messages in your incoming mailbox and a menu of options at the bottom of the screen. Following is a sample:

Mailbox is '/usr/spool/mail/raja' with 7 messages [ELM 2.4 PL21] ->N 1 Dec 20 Bosco Siaufung Tja (38) Re: Unsubscribe N 2 Dec 20 John David (141) Re: C251: Course grades N 3 Dec 20 Shankar N. Swamy (26) Emacs problem 4 Dec 20 Manoj K. Jain (14) lunch? 5 Dec 20 david andrew south (38) Re: your mail O 6 Dec 20 Derek G. Bridge (164) Call for papers and participation 7 Dec 20 Ian Radford (28) Re: Hi! You can use any of the following commands by pressing the first character; d)elete or u)ndelete mail, m)ail a message, r)eply or f)orward mail, q)uit To read a message, press <return>. j = move down, k = move up, ? = help Command:
The line at the top specifies the name of the current mailbox (/usr/spool/mail/raja) and the number of email messages in it (7). You can order the sequence of the messages in the mailbox in accordance to your preference. A popular ordering is by the reverse date of sending of the message. Note that some messages are flagged by a single character. Messages flagged with an N are new messages. Those with an O are old messages that haven't yet been read and unflagged messages are those that have been read but which haven't yet been deleted from the mail box. The -> marks the current message. You can change the current message by moving the -> arrow up or down with k or j respectively. To read the current message press the space bar.

At the bottom of the screen is a menu listing the most frequently used commands in elm. To invoke any of these commands just type the single character. When you are mailing a message you can compose the note using an editor. We have setup your configurations such that you can use emacs to compose your messages. To send a note type m. You will then be prompted with:

Command: Mail
Send the message to: raja 
Then type the user name(s) of the person(s) to whom you want to send the note. (Text typed in bold denotes user input.)
Command: Mail                           To: Raja Sooriamurthi
Subject of message: Question on p2 hw4
The Emacs editor will then be automatically invoked. After composing the message leave emacs as usual(C-x C-c). You will then have the options:
Command: Mail                           To: Raja Sooriamurthi
Please choose one of the following options by parenthesized letter: s
              e)dit message, edit h)eaders, s)end it, or f)orget it.
If you now want to cancel the message you may do so by typing f or else s will send the message. To quit from elm and to return to the Unix prompt type q.

There are several other options that you can use in elm. >From the main menu type o to get a list some of the other options. We'll also be giving a demonstration of these during the first lab sessions.

Don't forget to log out of the computer when you are all finished.

At this point you should have the basics that you will need for doing the work in this class. However, there is much more that you can do with UNIX and Emacs that these tutorials don't cover. Read the various handouts from UCS listed at the beginning of this tutorial to learn more, and don't be afraid to ask questions of your instructors.