Introduction to Linux, Mozilla, and Emacs

The Login Process:

The computers in the 2nd floor MCSP lab are dual boot, capable of running Windows XP or Fedora Core, a version of Linux distributed by Red Hat, Inc. Generally you will find them running XP so you will need to reboot into Linux as follows:

After Linux has been loaded you should get a login screen. To log in:

If you have problems logging in, make sure that you are entering the correct user name and password. If you ever have password problems, go to Information Technology on 3rd floor Trexler for assistance.

You are now logged into the local machine, but part of the file system you will be using has been mounted from Linux servers (that is, you will be storing your files and using programs on the Linux servers). You should see a desktop environment similar to Windows. This is GNOME, one of the most popular desktop environments for Linux. A separate window management program is running in conjunction with GNOME but we will loosely refer to everything in the windowing environment as GNOME. Here are some basics for getting around in GNOME:

Managing GNOME Windows

The windows you will use under GNOME will feel much like those under Windows 98, 2000, NT, or XP although a few things are different. Click on the xterm (terminal) icon on the Panel to get another xterm window, then use your two windows to get comfortable with these basics:

The Taskbar: First, notice that there are now two icons on the taskbar for xterm windows. Open two more xterm windows. You will either see 4 separate icons on the taskbar, one for each window, or only one icon, this time with a 4 in parenthesis. In order to make the taskbar less cluttered, , if you have several of the same type of window open, only one icon will appear on the taskbar. That one icon shows how many such windows are open. If you click on this icon, you will see a list of the individual windows and you can select one.

Moving Windows: To move a window, move the mouse pointer over the title bar of the window, then hold down the left mouse button down while you drag the window to the location that you desire. Then release the mouse button and the window will be moved. Alternatively, you can hold down ALT and then click anywhere in the window to drag it to a new location. This is particularly handy if the title bar is not visible.

Activating a Window: The window that has a blue title bar is the active window. Only one window can be active at a time. To make another window active, click inside that window or on its titlebar. This will both activate the window and bring it to the front. When you have more than one window open it is often helpful to cycle through them to get to the one you want to work in. The usual way to cycle through windows in Gnome is by pressing Alt-Tab (hold Alt down, then press Tab), just as in Windows XP. Now try ALT-Tab; it should cycle through the windows.

Resizing Windows: To resize a window, point to a corner, hold down the mouse button and drag the corner. The middle button (with a picture of a half-filled-in square) in the upper right hand corner can also be used to maximize the window (make it fill the whole screen) and then to change it back to the original size.

Minimizing Windows: To minimize a window, click the leftmost button (with a picture of a line at the bottom) in the upper right hand corner of the window. Note that for minimized windows the icons on the taskbar at the bottom of the screen are greyed out.

Closing Windows: To close a window, click the rightmost button (with a picture of an X) in the upper right hand corner of the window. Generally you won't want so many of the same type of window open so close some of the terminal windows.

Using Multiple Workspaces: GNOME allows you to have several different workspaces open simultaneously. For example, later in the course you may want to have one workspace with a terminal window where you are working on your personal web pages and another workspace with a terminal window to work on lab exercises. Or, you may want to have your browser open in one workspace, the emacs editor in another, or whatever. The GNOME panel shows your workspaces (a 2 by 2 grid -- and in each rectangle smaller rectangles indicating windows open in that workspace). At this point you should have one workspace open with a couple of windows open in it. To change workspaces, just click on the rectangle.

Moving Around the Linux File System

Now that you can get around the window environment, let's take a look at an xterm. Click on one of the terminal windows to activate it. The program running in the xterm is called the shell. The shell lets you issue commands to the Linux operating system and work with files. Refer to the handouts on the shell commands and Unix files given in class as you follow the directions below to move around the file system. Pay attention to what happens on the screen after each command.

Setting Up Your Directory

Now we'll set up your directory with some subdirectories and copy some files into them. Do the following:

STOP!!! Before going further have the instructor or a lab assistant come over and check to see that you have your directory set up correctly. You will be asked to go to your home directory, show a listing of the files there, then go down into the subdirectories you have created and show what is there.

Emacs

Launch Emacs You can do this either by clicking on the Emacs icon (a head with horns) on the Panel or by typing the command emacs & in a shell window.

The X-windows version of Emacs has a menu bar that you can see at the top of the editor. These are pull down menus that you can use to perform many commands. However, every command in a pull down menu can also be executed in Emacs using an Emacs function and special keystrokes. Once you become proficient at using Emacs you will probably prefer the keystroke method of giving commands.

Editing an existing file

We'll first use Emacs to edit the UnixQuestions file. To open this file in your lab0 subdirectory do the following:

Now, you are ready to edit. As in a word processor you may move around in the buffer with the arrow keys and with the mouse. Unlike a word processor however you should press the ENTER key when you are at the end of a line. Text editors typically do not provide the same automatic line wrap features that word processors do (though Emacs provides some).

A useful Emacs command: If you ever get stuck halfway into an Emacs command, where the minibuffer is asking for something that you don't understand, type C-g (hold down the ctrl key then hit the g key). This aborts the current command.

Now type in the answer to each question immediately following the question.

Save the file by typing C-x C-s (hold down the ctrl key then hit the x key, then release the x key while still holding the ctrl key and hit the s key) OR choose File, then Save (current buffer) from the menu.

Now go to the shell window and use the nenscript command to print out your answers. The command is as follows:

nenscript -2rG UnixQuestions

This tells it to print file UnixQuestions to the lab printer.

Mozilla

Mozilla is an open-source web browser; it looks and acts much like Netscape or Internet Explorer. Open Mozilla by clicking on the globe icon on the panel. First, you will want to change your homepage to the Roanoke College web page. Select Edit from the menubar, and then click Preferences. The preferences window will open, and on the right you should see a textbox for Home Page. Type in www.roanoke.edu and click OK. Clicking the Home button in the main browser window should now take you to the Roanoke home page. Now type the following URL (be sure to use the right one for your class) into the Location box:

http://cs.roanoke.edu/Fall2004/CPSC120A (Prof. Moore's class)

                      or

http://cs.roanoke.edu/Fall2004/CPSC120B (Dr. Ingram's class)
This takes you to the class web page. Bookmark this page by clicking on Bookmarks and then choosing Bookmark This Page. A window will pop up asking you what you would like to call the bookmark and asking where you would like to save it. Accept the defaults by clicking Add. Click on Bookmarks again and you should see that this address is there. You will use it often!

Look over the page; note that it contains links to the syllabus, to various useful information, and to the programs (none yet) and labs. Click on the lab 0 link and you'll see the online version of this document. Most labs will contain links that you need to follow, so in general you will use the online version.

Now go to myrc (http://myrc.roanoke.edu), log in, and go to the Outlook tab. Click on the new button in the upper-left hand corner, and address the message to your instructor (pmoore@roanoke.edu or ingram@roanoke.edu). Put UnixQuestions in the Subject line. Click Attachments, then Browse, and find your UnixQuestions file -- this is a graphical view of the file system, so double-click the folders to open them. When your have located the file, click Open and then Attach. The filename should now be under Current file attachments. To return to the message composition screen, click Go Back to Message. You should see your filename next to Attachments. Now, send the e-mail. After each lab you will e-mail your work to your instructor.

Close Emacs and Mozilla.

Exiting an X-terminal: To exit an xterm, type exit at the command prompt. (NOTE: You can also exit by clicking the X in the upper right hand corner of the window, as in Windows. It is a good idea to get in the habit of exiting the window or a program within a window with the exit command instead of destroying it with the X. Though most programs should respond appropriately to your clicking the X, destroying windows can sometimes make you lose information that you wanted to save. For example, if you are editing a file, and use the destroy button, you may lose unsaved data.)

Exiting GNOME

To exit GNOME, click on the RED HAT icon on the panel and choose Log Out. The logout option should already be selected in the window that pops up, so click on the "OK" option. This will take you back to the Linux login screen. At the bottom of that screen click on "Reboot" then click on Reboot to let the computer know that you are sure that's what you want to do! The computer will then automatically reboot Windows XP.