Introduction to Linux, Netscape, and Emacs

The Login Process:

Linux can be accessed in both the first floor general-use lab in Trexler and in the 2nd floor MCSP lab. The machines in these labs run Windows XP. Log into Windows as usual, then look for an icon on the desktop that says XWin to Riddler. Double click on this icon; you should get a "Welcome to riddler.roanoke.edu" 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 Services on 3rd floor Trexler for assistance.

The first time you log in, you may see a screen that asks you whether you want the default setup or not. If you get this screen, click on the option for the default setup.

You are now logged into Riddler, the Linux server. You should see a desktop environment similar to Windows. This is GNOME, one of the most popular desktop environments for Linux. By default, GNOME uses the window manager Sawfish, 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 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 plus one for rxvt and one for Start Here. Open two more xterm windows and you will see that only one icon for the xterms appears on the taskbar, this time with a 4 in parenthesis. If you have 4 or more of a given type of window open, only one icon appears on the taskbar for the type of window, and it 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 and border 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. 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. However, since you are logging in through Windows XP, this will just take you out of Linux and back to Windows. (Try it by pressing Alt-Tab. Once you're in Windows, you can get back to Linux by clicking on the Cygwin icon on the task bar.) You can modify you settings to make C-Tab (Ctrl-Tab) cycle through windows instead as follows:

Now try C-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 the group web pages. Or, you may want to have your browser open in one workspace, the emacs editor in another, or whatever. The right side of 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 (either rxvt or the default xterm -- from here on we will use "xterm" to mean either) 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).

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

Save the file by typing C-x C-s (remember the C stands for the control ctrl key -- hold it down then hit the x key, then release it 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 -p- UnixQuestions | lpr -P lab-mcsp -h

NOTE: The | (between UnixQuestions and lpr) is a pipe, which is the key just below the backspace key -- backslash is the other character on the key.
The document will be printed on the lab printer.

Netscape Communicator

Now we'll go through a brief introduction to Netscape Communicator which we will use for Web browsing and mail.

Start up Netscape by clicking on the Netscape icon on the Panel or by typing netscape & at the command line in one of your xterm windows. (The & at the end of the command tells the shell to run the Netscape program in the background so that the shell can be used to perform other tasks at the same time that the Netscape window is open.) Click through any dialogs that appear the first time you run Netscape. You may get an error window about disk caching; click ok.

You should see before you in the browser's main viewer a page about Red Hat Linux. Clicking on Home will take you to your home page (the page that is displayed when you start up Netscape), which by default is probably the Roanoke College home page or the Netscape page. We'll change this later in the lab if necessary.

At the top of the Netscape window you see a menu bar with several options including a File option that lets you do things such as open files and print files, and an Edit option that, among other things, lets you configure your personal preferences such as what you want your home page to be. Help can also be found on the right end of this menu bar. Below the menu is a series of buttons that can guide you through the documents you visit on the Web. The Home button always takes you back to the home page you have specified in your settings. Other buttons let you go backwards and forwards in your document history for this session, reload your document, print the current document, search the current document and stop the document from loading. At the end of this line, you see a picture of an N. Whenever this N is animated with shooting stars, a document is currently being loaded.

The line below the row of buttons contains the location of the document you are currently viewing. Each document ("page") on the Web has a location (in a file on a computer on the Web) which is specified by a URL (Uniform Resource Locator). A URL is basically an address of a page. The URL for the Roanoke College home page is http://www.roanoke.edu. If you know the URL of a page you want to see, you can type it in the location box (then press ENTER).

On the next line, you see several buttons that will automatically take you to locations that can help you navigate and find documents on the Internet.

Moving Around in Netscape -- "Surfing the Web":

There are several ways for you to access different pages on the Web:

If you have never used Netscape you should try out some of the options above at some point.

For now go to the home page for this class by typing the address

http://cs.roanoke.edu/~cpsc/CPSC120A (Dr. Bloss's class)

or
http://cs.roanoke.edu/~cpsc/CPSC120B (Dr. Ingram's class)

into the location box then pressing ENTER. Bookmark this page by clicking on the Bookmark icon, then choose Add bookmark. Click on bookmark again and you should see that this address is there. In the future when you want to visit this page just use your bookmark. This is the page that you will use throughout the term to get information related to the course.

Changing your Password:
The following are instructions for changing your email/Linux password. Note that changing this will change the password you use to read your e-mail, even under Windows. If you are still using the default password given to you by Information Services, change your password now (otherwise you don't need to):

Netscape Mail:

In this course you will often need to use the Linux version of Netscape to send mail to your instructor. You may also want to use this to read your mail. The primary mail server at Roanoke is a Dell computer named imap. All student mail addressed to username@roanoke.edu goes to imap. Netscape on Linux can be set up to use imap so that mail addressed to username@roanoke.edu can be read from Linux. Options for setting up your mail and other browsing features are under the Edit option on the main window. We'll now look at your current preferences and change any that need to be changed.

Do the following:

Getting into Mail: You can get into mail either by choosing Communicator, then Messenger or by clicking on the mailbox icon at the bottom right-hand corner of the window. You will need to enter your IMAP mail password (this is the same email password you have been using, which is also your Linux password) before you can access your mail.

Common Netscape Mail Functions:

Mail me a copy of your UnixQuestions file as follows: Go to your Netscape mail window (it should still be open -- if not, open it) and press the New Msg button. Put bloss@cs.roanoke.edu or ingram@cs.roanoke.edu (depending on which class you're in) in the To box. Now press the Attachment button. Choose File, then either choose the correct directory and file from the list (the file you should mail is the one named UnixQuestions) or in the selection box, type in the full pathname of your executable file. Press the Attach button then the Send button.

Close Emacs and Netscape.

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 FOOT icon on the panel and choose "Log Out", then select Yes at the "Really Log Out?" window. This will take you back to Windows XP; be sure to log out of here too.