Lab 0: Introduction to Linux and Firefox

Lab Objectives

  • Gain exposure to the graphical and command-line interfaces of the Linux operating system.
  • Setup access to online course information through Firefox

Getting started with Linux:

The computers in the 2nd floor MCSP lab are dual boot, capable of running Windows XP or Ubuntu Linux, an open source version of Linux. 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, enter your username and password (the same that you use to access myRC and email) and press Enter. 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 you will be storing your files and running programs from a remote computer (named "CS"). This means that you can use any computer in the lab and still be able to access your personal files.

You should see a desktop environment similar to Windows. This is GNOME which is responsible for providing a graphical, desktop interface for Linux. Here are some of the basics for getting around in Gnome.

The GNOME panel can be customized by adding and deleting icons and moving them around. In this course we will regularly use three applications: X-terminal windows (for typing in shell commands), Eclipse (for writing programs), and Firefox (for an online copy of lab instructions and sending email to the instructor). Occasionally you will use a Text Editor (for providing answers to lab activities). It would be helpful to add icons for these on the panel.

Launch an X-terminal window (an xterm) by clicking the icon on your panel. You should see a window appear has nothing in it except a command prompt. (A prompt is a special character or sequence of characters letting you know the shell is ready to accept commands - the prompt on the lab machines contains your username, the machine name, the pathname of the current directory and a dollar sign. The dollar sign is one of the standard UNIX prompts). Shell commands are typed in an xterm at the prompt -- more on shell commands later.

The windows you will use under GNOME will feel much like those under Windows XP. However, there are a couple of tips that you should be aware of. Click on the text editor icon and the Firefox icon on the Panel to open two more windows, then use your three windows to get comfortable with these basics:

Moving Windows: As usual, windows can be moved by clicking on the title bar and dragging the window with the mouse. 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 brown 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.

Using Multiple Workspaces: GNOME allows you to have several different workspaces open simultaneously. This is something that you have probably not experienced with a Windows interface. This feature can be useful in grouping together windows that are supporting different tasks. For example, 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. Alternatively, you may want to have a full-screen browser open in one workspace and Eclipse in another. The GNOME panel shows your workspaces (a grid of 2 rectangles in the right hand corner of the taskbar -- in each rectangle smaller rectangles indicate windows open in that workspace). At this point you should have one workspace open with 3 windows open in it. To change workspaces, just click on the corresponding rectangle.

Using the Command Line Interface

Windowing environments provide a graphical interface to the computer that leverages the strengths of the human perceptual system. We can easily locate and manipulate symbolic representations of our data by using the mouse to point, click and drag. While this kind of operation is highly intuitive, it is not always the most efficient. For this reason, it is sometimes beneficial to interact with the computer system by using descriptive commands that explicitly tell the machine what to do. The command-line interface for Linux systems is accessed through an X-terminal(xterm).

You should already have an xterm open; click to activate it. The program running in the xterm is called the shell. The shell lets you issue commands explicilty to the Linux operating system and work with files. Refer to the Linux Command Reference and Linux/Unix Overview handouts given in class as you answer the following questions and type in the appropriate commands 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.

Using the Text Editor:

Launch the Text Editor (if it isn't still open) by clicking on the icon on the Panel. You will note a menu bar and a bar of icons at the top of the window. These contain pull down menus and icons that you can use to perform many commands. You should also be aware that many commands can also be executed using special keystrokes. These keystrokes appear next to the commands in the menus. Many people find the keystrokes more efficient once they become used to a software package. Try experimenting with the different ways to invoke commands to see what you are most comfortable using.

Editing an existing file

Open the UnixQuestions file using the appropriate menus, icons or keystrokes. Notice that the directories that you created using the command line interface are shown here as folders. Remember that the file you are looking for is in the path: ~/cs120/Labs/lab0 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.

Go to the top of the document and type in your name as the answer to question 0, then type in the answer to each question immediately following the question. Notice that as soon as you make any change to the document that the filename (both on the window titlebar and in the taskbar) is preceeded by an asterisk (*). This is an indication that you have changed the document but have not saved your work. You should always save your work periodically!

When you finish answering all the questions, save your work and activate the shell window. Use the ls command to list the files in your lab0 directory. You should notice that you have at least two: one is UnixQuestions and the other is UnixQuestions~. The one named UnixQuestions is your most recently saved version of the file; the one with the ~ at the end is an older version of the file (if you only saved once it is the original file that had the questions with no answers).

Printing

Before printing you need to set the default printer. On the Panel choose System, then Preferences, Default Printer. Choose the 2nd floor lab printer then click Set Default.

To print out your answers, use the enscript command in your xterm (shell) window as follows:

enscript -2rG UnixQuestions

This requests that the file UnixQuestions be printed on the lab printer. The additional parameters to the print command tell the printer how you would like the document formatted. Specifically, you are asking for 2 columns, rotated to landscape orientation and add a Gaudy title.

Do not print from within the text editor; always use enscript
Do not print from within the text editor; always use enscript
Do not print from within the text editor; always use enscript

Firefox

Firefox is an open-source web browser that looks and acts much like Internet Explorer, Safari or Netscape. Open Firefox by clicking on the icon on the panel. First, we want to set the class webpage to be your homepage. Under the Edit menu, select Preferences. The preferences dialog will open, and on the right you should see a textbox for Home Page.

If you are in Dr Ingram's class, type in:

http://cs.roanoke.edu/Fall2008/CPSC120A 
If you are in Dr. Bouchard's class, type in:
http://cs.roanoke.edu/Fall2008/CPSC120B 
Close the dialog and press the Home icon to go to the class web page. Look over the page; note that it contains links to the syllabus, to various useful information, and to the assignments (none yet) and labs. Click on the lab0 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. (Alternately: You can go straight to Outlook without going to myRC by going to http://owa.roanoke.edu). Bookmark this link - you will use it every lab to submit your work via e-mail.

  1. Click on the new button in the upper-left hand corner, and address the message to your instructor (bouchard@roanoke.edu or ingram@roanoke.edu). Put Lab0 in the subject line.
  2. Click Attachments, then Browse, and find your UnixQuestions file When you have located the file (remember to choose the one named UnixQuestions NOT UnixQuestions~), click Open and then Attach. The filename should now be under Current file attachments.

  3. To return to the message composition screen, click Go Back to Message. You should see your filenames next to Attachments. Now, send the e-mail.

Log off myRC then close Firefox.

Exiting an X-terminal: To exit an xterm, type exit at the command prompt.

Exiting GNOME To exit GNOME, click on the System option on the panel and choose Quit. In the next window, select the "Restart" option if you are through using Linux. The computer will then automatically reboot Windows XP. (If you click the "logout" option the computer will go back to the Linux login screen.)