Fundamentals of Computer Science I: Media Computing (CS151.02 2007F)

Laboratory: Getting Started with Linux

This lab is also available in PDF.

Summary: This laboratory reviews some mechanics related to the use of the Computer Science Linux Network for CSC151. Specifically, this lab discusses:

Please don't be intimidated! Although this lab contains many details which may seem overwhelming at first, these mechanics will become familiar rather quickly. Feel free to talk to the instructor or with a Linux User Consultant if you have questions or want additional help!

Logging In

Short Version
  • On the computer in front of you, you should see a small window that asks you to log in. If you don't see such a window, try hitting a key on the keyboard or clicking the power button on the monitor.
  • Enter your user name. Press the <Enter> key.
  • Enter your password (which won't appear). Press the <Enter> key.
  • Get help if those previous two steps don't work.

To use any of the computers on Grinnell's Linux network, one must log in, identifying oneself by giving a user name and a password. You will have received a Linux user name and password from the instructor if you did not already have one. If you have not received a Linux user name and password, or if you have forgotten either one, please tell your instructor.

When a Linux workstation is not in use, it will display a login screen with a space into which one can type one's user name and, later, one's password. (If the workstation's monitor is dark, move the mouse a bit and the login screen will appear.) To begin, move the mouse onto any part of the box containing the login box. Type in your user name, in lower-case letters, and press the <Enter> key. The login screen will be redrawn to acknowledge your user name and to ask for your password; type it into the space provided and press <Enter>. (Because no one else should see your password, it is not displayed on screen as you type it in.)

At this point, a computer program that is running on the workstation consults a table of valid user names and passwords. If it does not find the particular combination that you have supplied, it prints a brief message saying that the attempt to log in was unsuccessful and then returns to the login screen -- inviting you to try again. Consult the instructor or the system administrator if your attempts to log in are still unsuccessful.

The Linux/Gnome Window Environment

Short Version
  • You'll see something that looks somewhat like Microsoft Windows, but also somewhat different.
  • Icons at the bottom of the screen can be used to start programs.

Once you have logged in, a control panel will appear at the bottom of the screen. Some other windows also may be visible in other parts of your screen. All of these areas are managed by a special program, called a windowing system. On our network, login chores and other administrivia are handled by a program or operating system, called Linux, and the primary user interaction is handled by a windowing system, called Gnome.

Practice with a Terminal Window: Changing Your Password

Short Version
  • Click on the picture of the small computer monitor. A new window, called the Terminal, will appear.
  • Type yppasswd and hit the <Enter> key to change your password. You will be prompted for your old password and your new password.
  • Type exit and then hit the <Enter> key to close the window.

While we can run several programs directly, we will need to invoke others by name. The computer program that reads and responds to such invocations is called the shell, and your interactions with the shell takes place in a window generated by a program called a terminal emulator, or terminal for short.

You may already have a Terminal window on screen. If not, you can start one at any time by moving the pointer onto the small monitor icon at the bottom middle of the front panel, and clicking with the left mouse button. Shortly a window appears, displaying the shell prompt -- the name of the workstation on which the shell is running, followed by a percentage sign. This prompt indicates that the shell is ready to receive instructions.

You type in such instructions using the keyboard. Move the mouse pointer into the Terminal window and click the left mouse button to make the window active. Notice that the window frame changes color following the click, indicating that the window has become active.

To get rid of the Terminal window, press <Ctrl/D>. That is, hold down either of the keys marked <Ctrl>, just below the <Shift> keys, and simultaneously press the <D> key. (On our workstations' keyboards, the keys marked <Ctrl> (control) and <Alt> (alt or meta) are somewhat like <Shift> keys, in the sense that they modify the effect of other keys that are pressed simultaneously.) The shell program interprets <Ctrl/D> as a signal that you have no more instructions for it and halts, and the terminal emulator closes the window automatically once the shell stops running. Alternatively, you may close a window by moving the mouse to the x at the top-right of the window, and clicking the left mouse button. Finally, you can usually type exit to close a terminal window.

It is a good idea to change the password associated with your account shortly after you receive it and every few months thereafter. The program that one uses to change one's password is by its name, yppasswd.

Choose a new password. Make it something that you can easily remember, but not an English word or a name, since it is easy for system crackers to break in by guessing your password if you choose it from one of those categories.

Open a terminal window, select the window by clicking the left mouse button in it, and type the word yppasswd. The password program prompts you once for your old password -- the one you logged in with -- and twice for your new password. If you give your old password correctly and the two copies of your new password match, the program substitutes the new password for the old one in the table that the login program consults. The old password is discarded and will not be recognized in subsequent logins. (If the attempt to change the password fails for any reason, however, the old password is retained.)

A typical interaction to successfully change a password looks like this:

   bourbaki% yppasswd
   Changing NIS account information for user on hopper.math.grin.edu.
   Please enter old password:
   Changing NIS password for user on hopper.math.grin.edu.
   Please enter new password:
   Please retype new password:

   The NIS password has been changed on jacobi.math.grin.edu.

   bourbaki% 

After running the yppasswd program, the shell takes over again and issues another prompt. You can invoke as many programs as you like from the shell, one after another, before pressing <Ctrl/D> or exit to leave the shell.

Iceweasel/Firefox

Short Version
  • Start Iceweasel by clicking on the picture of the small white creature grasping a green sphere.
  • Agree to any dialog boxes that appear. They shouldn't appear again.
  • Learn how to get to the front door for this class.

While some materials for this course will be available in paper, almost everything for this course (including electronic versions of paper materials) will be available on the World Wide Web. In this class, we use a version of the Firefox browser called Iceweasel. Almost all of the materials for this course will be distributed over the Web. To use Iceweasel to view materials, such as this course's syllabus and this lab, you may follow these steps:

First, prepare to use the World Wide Web by clicking on the Iceweasel icon (the picture with small white creature holding a green sphere). Iceweasel is a version of Mozilla Firefox renamed to accommodate trademark issues. More info on the relationship between Firefox and Iceweasel can be found at http://en.wikipedia.org/wiki/Naming_conflict_between_Debian_and_Mozilla. I will generally use the terms interchangeably.

The first time you run Iceweasel on our network, two message boxes might appear.

You should approve of any requests by clicking on the appropriate word. The pop-up boxes then disappear; you should not see them on subsequent uses of Iceweasel.

Initially, Iceweasel displays a World Wide Web document containing some default information. You should switch to the page http://www.cs.grinnell.edu/zero-one.xhtml, which is an entry point to the Computer Science Department's Web site.

I expect that most of your are already familiar with a Web browser. If not, please consult with me or one of your colleagues.

To find material for this course, scroll down the origin page for the Computer Science Department to the list of course front doors. Now scroll down this page to find the entry for this course, Fundamentals of Computer Science I, Section21, and click on it to locate the front door for this course. Next, click on the Syllabus link to view the current draft of the semester's schedule. If you click on the Current link, you'll see an outline of today's class.

You can also connect to the Web page for this class by selecting Open Web Location from the File menu and then entering http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2007F/

Iceweasel Options

Short Version

Each Linux user can configure Iceweasel to reflect her or his own preferences. Between logins, these preferences are stored in a file in the user's home directory; when Iceweasel is started during a later session, they are reinstated from that file.

Every user of Iceweasel in this class should establish a base page, a starting point for browsing. Here are the Uniform Resource Locators or URLs of some good choices:

To establish your base page, within Iceweasel, bring up the Edit menu from the menu bar and select the Preferences operation. A pop-up window appears, allowing you to configure many features of the general appearance of Icewesael. Choose the General option, if it has not been chosen already. The rectangle labeled Home Page contains the URL of some document that serves as the default. Replace the contents of this rectangle with the URL of your choice. (This does not have to be a permanent change; you can change your mind about this configuration at any time within Iceweasel.)

To erase the current contents of the Home Page Location(s) box, move the mouse pointer to the left of the first character in the box, press the left mouse button and hold it down, and drag the mouse pointer rightwards until the entire URL is displayed in reverse video, white letters on a black background. Then release the left mouse button and type the new URL; the old one will vanish as soon as you start typing. Once you have entered the new URL, move the mouse pointer onto the button marked OK at the bottom of the pop-up window and click on it with the left mouse button.

You can, of course, simply navigate to the page you want to use as your home page and then click on Use Current Pages.

You may note that the button says Pages (plural) rather than Page (singular). Since Iceweasel permits tabbed browsing (that is, you can have tabs within the same window that you switch between), you can have a home set of tabs. Particularly obsessive people might want to set up a sequence of tabs with say, the current outline, the current eboard, the current reading, the current lab, and Plans (for when you get bored).

DrFu

As you've probably heard by now, we are making algorithms for creating and manipulating images a central central theme of this course. The program that we are using to do image manipulation is called The GNU Image Manipulation Program, typically referred to as The Gimp. Of course, we also need a language in which to express those algorithms and an environment in which to write those algorithms. The Gimp comes with a language, called Script-Fu, for writing algorithms. Unfortunately, the environment for writing programs in the Gimp is, to put it politely, rough. In response, we've written our own environment, using a pedagogical program development environment called DrScheme. We call our hybrid DrFu.

Your first task in getting DrFu running correctly is to add an icon to the task bar. (Almost as importantly, once you figure out how to add a DrFu icon, you will also be able to add other applications that you want to use.)

Short Version
  • Right click on the task bar. A pop-up menu should appear.
  • Select Add to Panel ... from that menu. A dialog box should appear.
  • Select Custom Application Launcher, which should be the first item in the dialog box, and then click Add. Yet another dialog box should appear.
  • Enter "DrFu" in the Name field.
  • Enter nothing in the Generic Name field.
  • Enter "Media Program Development" in the Comment field.
  • Enter "/home/rebelsky/glimmer/bin/drfu" in the Command field.
  • Leave Type as Application.
  • Click on the button that says No Icon. A browse window should appear.
  • At the top of the icon browser is a string, like /usr/share/pixmaps. Replace that with "/home/rebelsky/glimmer/pixmaps" and hit enter.
  • You should see an icon named "drfu" or something similar. Double-click it. You will return to the Create Launcher
  • Click OK
  • Click Close to close the Add to Panel window.
  • You should now see the new icon in your task bar. Try clicking it.
  • When DrFu starts, it will complain that you have not yet chosen a language.
  • Select Choose Language from the Language menu.
  • Click on Dr-Fu.
  • Click on OK.
  • Quit.

Most user interface systems provide a convenient way to access commonly-used applications. In Gnome, we often add such applications to the Task Bar. To add an application to the task bar, we need to tell Gnome about where to find that application and what icon to associate with the application. (We can tell it other things, too, but that's enough for now.)

I will admit that I have not found an elegant way to automate the addition of an icon to the panel, so we'll do it by hand. You first tell the panel that you want to add something by right clicking in an empty area of the panel and then selecting Add to Panel .... (The ellipses tell you that you should expect to provide more information.) We're going to add an application launcher for a locally-developed application, so we must create a custom application launcher. Click on the Custom Application Launcher option and then click Add. The Create Launcher window appears.

You will note that this window gives you about seven things to set up for the launcher. The Name is what we use to refer to the application. In this case, we'll use "DrFu". The launcher shows this name when you pause the cursor over the icon for the application. We will not worry about the generic name. The Comment is additional information about the application, and also appears when you pause the cursor over the icon for the application. We'll use Media Program Development here, but you can choose other text that you find helpful.

The Command is the most important thing to fill in. The command tells the launcher how, in particular, to start your program. Typically, we tell it where the program can be found and, in some cases, provide additional information on how to launch it. Since we're using DrFu you should enter the following

/home/rebelsky/glimmer/bin/drfu

Finally, it is convenient to associate an icon with the application. If you click the No icon button (which certainly has a strange name), you'll be presented with a wide variety of possible icons. You may certainly choose one of these. However, for uniformity we recommend that you use the custom icon for this version, which is in a different location on the computer than the system first looks. You'll need to enter /home/rebelsky/glimmer/pixmaps/ to tell it where to look, and then select an appropriate icon.

You're almost done. You've chosen the name, description, command, and icon. You now need to click OK to accept the new button, confirm that it appears, and then close the Add to panel.

Now it's time to start DrFu. Click on the icon. As we mentioned earlier, DrFu is a version of DrScheme customized for use with the Gimp and Script-Fu. Because DrScheme can work with a variety of languages, you'll need to choose one. Select Choose Language ... (there are those ellipses again) and then double click on Dr-Fu under Experimental Languages. That should be enough to convince DrFu to work correctly, but we need to quit and restart before we can do anything else. It's also likely that you'll have to quit the Gimp before restarting DrFu.

Why do we have to select a version of Scheme? Because as the Scheme Programming Language has evolved, a few dialects have evolved. (You certainly expect that dialects exist for human languages; it turns out to happen for computer languages, too.) The DrScheme environment also has a few versions that include additional built-in functions and a few versions that are simplified for novice programmers. The fact that DrScheme permits multiple languages is actually quite helpful - we wouldn't be able to have DrFu without it.

Finishing Up and Logging Out

If you've successfully logged in, changed your password, started Iceweasel, selected your base page, created an icon for the Gimp, started the Gimp, created an icon for DrFu, and started DrFu, you've completed the lab and you can finally stop.

Short Version
  • To log out, click on the menu icon near the lower left, select Log out, and confirm.
  • Do not turn off the monitor or computers.

When you are done using a workstation, you must log out in order to allow other people to use it. To log out, move the pointer onto the menu icon near the left of the front panel, click the left mouse button, and select the Log out option. A confirmation box will pop up, asking you to verify that you're ready to log out; move the pointer onto the word Yes near the bottom of this box and click the left mouse button. The Gnome windowing system vanishes, and after a few seconds the login screen reappears; this confirms that you're really logged out.

Please do not turn off the workstation when you are finished. The Linux workstations are designed to operate continuously; turning them off and on frequently actually shortens their life expectancy.

 

History

 

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Mon Dec 3 09:55:08 2007.
The source to the document was last modified on Mon Sep 17 14:43:19 2007.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2007F/Labs/linux-lab.html.

You may wish to validate this document's HTML ; Valid CSS! ; Creative Commons License

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright © 2007 Janet Davis, Matthew Kluber, and Samuel A. Rebelsky. (Selected materials copyright by John David Stone and Henry Walker and used by permission.) This material is based upon work partially supported by the National Science Foundation under Grant No. CCLI-0633090. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.