Introduction to the Lab (intro)
CS 161 - Spring 2005


Goals
- to become acquainted with the Linux/Gnome environment
- to learn how to turn in assignments using submit
- to give instructor contact information

Overview
For this lab, you will login to a workstation running Linux / Gnome with your personal account. You will arrange your screen so that you have a file viewer and terminal window as shown. You will create a folder for storing your work for this course and then create a small text file containing some basic contact information. You will save that file and submit it to your professor much as you would submit an assignment for grading. These steps are detailed below. Each step is summarized in bold and then described in more detail.

The Gnome interface

In the second part of the lab, you will type in a C++ program and learn to use the C++ compiler. Finally, you will create a second small C++ program on your own but based on the previous one. Together, the three submitted documents will be graded and will count as a regular assignment.

How to Use the Linux / Gnome Environment

Log in: You should see a login panel asking for your user id. Type your user id (first initial, middle initial, your whole last name). Press tab to move to the password field. Type your password (first and last initials and last 4 digits of student ID) using the number keys above the letters and not the numeric keypad. You won't see your password on the screen. Press the Options button and choose the Gnome environment. (The system should remember your choice. If you miss this part, please ask for help.) You should see the word 'debian' and various startup messages and eventually a panel of hints. Click the Close button on the hints for now. Note that your email address is  userid@cs.millersville.edu

Open Terminal: Although overall this is a graphical interface, you will interact with the compiler by typing commands. If you connect to the lab machines over the Internet, you will use a similar terminal interface with typed commands.

Click the Terminal icon on the upper menu bar.

Drag the window by its title bar to the right hand side of the screen as shown. You will type commands in this window. If you wish to adjust its size, drag the lower right corner. Leave it 80 characters wide so that you can see program output and error messages.

Change Your Password: Anyone who knows you well can guess your password. You should change it to something you will remember but is not guessable. It should not be a word, should contain a non-alphabetic symbol in the first 6 characters, and should be at least six characters long. Upper and lower case are significant. Think about it before you change it. It is non-trivial to fix a forgotten password, so make it something you'll remember and won't mistype. Do not type password numbers with the numeric keypad.

To change your password, type yppasswd in the terminal. You'll type your old (given) password, the new password, and then the new password again to make sure you have it right. What you type is invisible here.

Create and Open 161 Directory: Open the file viewer by double-clicking the home directory icon on the upper left of your desktop. Be patient here. The window takes a few moments to appear.

In the file viewer's menus, choose File/Create Folder. Name the directory 161, and click OK. Note that file and directory names should not end in punctuation or spaces; 161 is just three digits. Click on the name if you made a mistake. Double-click on the 161 directory to open it. You will create and modify your programs for this class in this directory.

Move to 161 Directory in Terminal: The terminal and file viewer do not move around in the file system together. Although the file viewer is looking in the 161 directory, the terminal starts at your home directory every time you start a terminal session or login. (It may start where you were the last time you were using a terminal.) The current directory is displayed as part of your terminal prompt,
  userid@machine  folder  number  >.

Every time you login to work on your programs for this class, you must make sure that the terminal's directory is 161. Do this by typing cd 161 at the prompt. You can check where the terminal is by typing pwd or looking at your prompt. That's why we've included the directory there. It's handy. The answer to pwd should be where you were the first time but with /161 on the end.

Create Information File: We will be using the emacs editor for creating our files in this course. In the lab, it's a point and click editor. But to use it from outside the lab, you'll need to learn some commands. It provides flexibility as well as a lot of power, but we'll ignore the power aspects for now. For now, we'll use point and click.

Launch (start) emacs from the menu bar at the top by choosing Applications then Accessories and then Emacs. In the emacs window that comes up, choose File/Open File. At the bottom of the emacs window, there will be a line giving your current directory and a place to type either the name of the file you want to open or a new file name. Type myinfo.txt and press return. In the bar dividing the empty area where you'll type and where you typed the file name, you should see the name of the file as well as a line number indicator.

Click in the top area if the text cursor isn't already there. Type your name, your phone number, and a short description of why you are taking this class (one or two sentences). Proofread your typing. You can use the mouse to move around.

Save the file using File/Save (current buffer).

Quit emacs using File/Exit Emacs. If you didn't save correctly, quitting will ask you whether you want to save the file.

Submit your File: For this course and many others in the CS department at Millersville, you will usually turn in assignments by using a program called submit. This program copies the specified file, usually your program, to a special account set up for your course. The account's name will be your professor's last name and the course number. Only that account's owner can see the submitted file. If you revise your program, you can submit it again. The most recently submitted version is graded, but the older versions are still available for the grader's review. You must be in the folder containing the file you want to turn in. Always make sure you have saved your file before submitting it.

In the terminal, get a long file listing by typing ls -l (those are letter l not digit 1 and there is a space after the ls). This should show that you have a file called myinfo.txt and that it is bigger than 0 characters. The listing below shows a file 239 characters long and last changed at 6:20pm.
   -rw-r--r-- 1 sabeach csmajor 239 Sept 4 18:20 myinfo.txt
Type submit and think about your answers to give it to your course's account as the intro lab. That folder is accepting only files ending in .txt. If you get message saying that you have no files to submit, check the name of your file and rename it to end in .txt if it doesn't.
When you get back to a prompt, type submitlog to see a record of what you submitted.

Check your Email: The best way for you to check your email is through the web. Open the Firefox web browser by choosing Applications then Internet and then Mozilla Firefox. Note that your email on cs (our server) is not the same as your marauder email. The address for @pen Webmail on cs is:
   http://cs.millersville.edu/openwebmail
Use your cs userid and password. The rightmost icon of the set at top left exits this mail program.

This picture shows the file system for a student with userid sabeach.
Her home folder is ~sabeach with two sub-folders, 140 and 161.
Tree picture of file system

Practice Some Terminal Commands: Learning a few terminal (Unix bash shell) commands will make it easier for you to use the system. You'll learn these commands as time goes by. You will use the terminal to compile your programs, and if you are connecting to these machines from outside the lab, you will get a terminal when you connect. If you plan to work a lot from outside the lab, you might want to explore the emacs non-menu commands. Emacs is much more powerful than pico.

In the terminal, type the commands in the left column. The right column describes what you are doing.

When you complete that series of commands, you should be back at your 161 folder. If not, figure out how to get there. Remember that you always need to move the terminal into ~/161 to work on files for this course.

CommandMeaning
cd move to your home folder (~sabeach)
pwd print the current directory name
ls list files in home (161 should be there)
ls -l list files, last time changed, size, and permissions
cd 161 move into 161 folder
cd .. move one folder up file hierarchy
!p repeat most recent command that started with p (pwd)
cd 161 move into 161 folder
!! repeat previous command (this gives you an error message because there is no ~/161/161)
man pwd print manual for 'pwd' command; press spacebar to get next page if necessary; press 'q' to quit

Log Out: From the menu at the top of the screen, choose Desktop/Logout. You will be asked to confirm quitting. You are logged out when you see the login panel on the screen. Normally, before you leave the lab, you should log out this way. Save any work before logging out. Close anything you don't need for the next time. I leave my screen looking like the one at the beginning of this handout.

You'll login again to start the next part of the lab activity.

Further Exploration: There are many ways to learn about the system and get help. Explore these outside the lab time:
- explore the Help menu
- use Applications/Internet/Mozilla FireFox to get a web browser and visit
   http://cs.millersville.edu/~katz/cs161.html    and    http://cs.millersville.edu/~elzer/161