Lab 1: Introduction to UNIX

Copyright RIT 2003
$Id: writeup.xml,v 1.6 2003/09/19 00:17:38 vcss231 Exp 1 $


Goal

The primary purpose of this lab is to acquaint you with the computer system you will be using this year, and to introduce you to the basic tools you will need to do your work.


Team Setup

You are to work on this lab on your own. However, feel free to discuss approaches with others in the lab, and do talk to your lab instrurctor if you need any help!

Overview

Objectives

Ask Dr. Tiger

Pre - Lab Work

  1. Find out the four letter code for your major. For example, the Computer Science program (both BS & MS) is VCSG.

  2. Bring a copy of your course schedule with you to lab.

In-Lab Activities

Each lab you will do is separated into a set of activities. Each activity has specific things you must hand in to get credit for it. Each activity is graded separately.

Activity #1 : Changing your Password and Registering in the Course Database

Your lab instructor will give you a computer account in lab. The information will be on a sheet of paper containing a login name and a password. This account is your permanent CS student account and you will use this account in all of the CS courses that you take at RIT. Note that, although the account name may be the same, this account is not the same as your RIT DCE account. Your CS account will remain active as long as you are a student at RIT and you do not violate the Code of Conduct. Take a few minutes to review the CS code of conduct by reading http://www.cs.rit.edu/usr/local/pub/doc/CodeOfConduct.txt.

Your permanent account name consists of your three initials followed by four randomly generated digits. The password is a random collection of letters, digits and/or punctuation.

Changing Your Password

You should have in your possession a document called the Beginner's Guide to Workstations, UNIX, and the Sun Java Desktop Environment It is also available on line at http://www.cs.rit.edu/~f2y-grd/beg-guide.pdf. At this time read and do all the exercises in sections 1 through 2. This will walk you through an introduction to the workstation, and talk about how to change your password.

You want to make sure you change your passord now being that the randomly generated password that was given to you is very simple, and could easily be discovered by a cracking program.

How To Submit

Move the mouse so the mouse pointer is in the terminal window, click on the border at the top, and type the following command.


	try grd-231 register /dev/null
				

This runs a program that will register you in our grading data base. It will ask you what lecture section you are in and what lab section you are in. The program provides a list of section numbers specifying instructors and times to help you; however, it would be useful if you had your schedule with you for this lab session.

Please make sure you put the correct section numbers into the computer, and that you don't mix up the lecture section with the lab section! Mistakes here will cause delays in your assignments being graded until the necessary corrections are manually made.

After you have finished registering, type the command again. This time the command should tell you what information you have entered. If this does not happen, or if the information is incorrect, notify your lab instructor right away!

Activity #2 : Basic File Editing

Creating Directories

By the time you finish CS1 and complete all the labs you might find that you have created as many as 200 files. In order to organize your account so that you can find things, you should create directories in which you will place related files. You should try to select names for your directories, and for your files, that make sense. For example, the name Labs might be a good choice for the name of a directory that contains your lab work.

By using directories to organize your files, you can usually locate the files that you need to work with rather quickly. Dr. Tiger has some advice at http://www.cs.rit.edu/~vcss231/Labs/Tips/unix-w1.html on how to keep track of directories and navigate through them, and at http://www.cs.rit.edu/~vcss231/Labs/Tips/unix-w3.html on how to manipulate files contained in your directories. You may also be interested in the Unix Reference Card (http://www.cs.rit.edu/~vcss231/Misc/unixRef.htm) for a quick list of common commands and examples of how to use them.

In your home directory create a directory named Courses and then make that your working directory. Now create a directory named CS1 and make that your working directory. In the CS1 directory create a directory to hold your laboratory work (Labs), and a directory (Progs) to hold any programs that you write on your own.

Now since you are working on lab 1, make the Labs directory your working directory and create a directory named 01 that will hold the work that you do for this lab. Make the 01 directory your working directory.

Getting Copies of Files Needed for Labs

Nearly all the labs you do for this course will require that you get copies of files provided by the instructors and edit them. This will be done by providing links to the files which, when clicked on, will place a copy in the working direcory.

For this activity, you will be asked to fill out a survey containing some simple questions about your background. Fetch a copy of the file containing the survey from this link (Auxiliary/survey) .

Use the right mouse button on the link to find out how you can copy the target of the link to your own account so you can edit it. This should bring up a window where you indicate where you want the file downloaded. Be sure to save this file in the directory you created for this lab.

Editing with emacs

To complete this activity you are to use the emacs editor to fill in the survey you obtained. Be sure you look at http://www.cs.rit.edu/~fyj/cs1/Emacs/editing.html before starting this activity.

Filling out the survey

Start up the emacs editor by entering the command:


	emacs &
			

Now load the survey file you fetched as part of the previous activity by performing the steps listed below:

Answer the questions in the survey file by replacing the fields marked by the phrase YOUR_ANSWER_HERE with the appropriate information. You can do this by using the arrow keys to move through the file and answer the questions as you go, or you could let emacs find the phrases for you. If you want to try it, follow the steps outlined below:

In several cases, a block of questions is preceded by a general question that requires a yes or no answer. Obviously, if your answer is "yes," you proceed to answer the additional questions. If your answer is "no," just skip to the next major question.

When you are done, save the file by selecting File on the toolbar, then save buffer, then exit.

WARNING: If you accidently enter a Ctrl-s in a UNIX window it will freeze that window. This means that any typing you do will not appear, but be saved, as in a queue. To unfreeze the window enter CTRL-q.

WARNING: If you get into trouble and need to exit remember that CTRL-x CTRL-c (written as C-x C-c in emacs terminology) will always get you out.

How To Submit

Almost all of the work that you do during lab will be submitted electronically to your lab instructor using the try command. The try system is a set of UNIX programs developed at RIT that are used for electronic submission of a student's work. In this course, it is used to turn in lab work; in later courses, you will also use it to submit programming projects.

The basic form of the try command is:

try instructor-account assignment-code file-list

where for this course, instructor-account will always be grd-231. The assignment-code is a name unique to each assignment which is specified in a lab or project handout; an example is lab1-3, meaning lab number 1, activity 3. The file-list is a list of files you are submitting for this assignment. The try command(s) to use for each assignment will be given in the assignment handout.

Now submit the survey to your lab instructor by executing the following try command from a UNIX window:


try grd-231 lab1-1 survey
				

After you type in the command, you should see output similar to that given below:


Copying files...done

ON-TIME submission of lab1-1

Files being saved:
survey

lab1-1 has been submitted.
				

The key phrase you want to look for when using try to submit your work is "has been submitted". When you see this phrase you know that your work was succesfully processed by try.

The try system uses the system time to determine when your work was submitted and will not accept work after the due date. You should finish your work early and submit it as soon as you are done. Submit each activity as soon as your are finished with it. The labs get very busy the night an assignment is due! Although you may start to run try before midnight, it may not finish before midnight. The best strategy is to finish before the labs get crazy, then you can sit back and watch others panic. For more detailed information about try refer to the Student's Guide to Try at http://www.cs.rit.edu/~vcss231/Misc/try.html.

To complete this activity you must print out a copy of your survey and give it to your lecture instructor at your next lecture. You can print a copy of the survey file by executing the following UNIX command:


	lp survey
				

Activity #3 : Using Electronic Mail

Introduction

The purpose of this activity is to familiarize you with the e-mail on the Department of Computer Science (DCS) systems. Your instructors will communicate with you via e-mail. All of your lab grades will be sent to your CS account electronically. Although many of you are probably accustomed to using your own e-mail account on a personal machine, it is important that you are equally as proficient reading mail from the UNIX machines, as all official department correspondence will be sent to your Computer Science account.

Your CS e-mail address consists of your username (i.e., your login name) followed by "@cs.rit.edu". So for example, if your login name is abc1234, your e-mail address would be abc1234@cs.rit.edu. Anyone connected to the internet can use this address to send you e-mail.

Reading Your E-mail Locally on UNIX

There are many mail clients available on the CS systems that you can use to read your e-mail. Perhaps one of the easiest to use is SeaMonkey. To get to the e-mail program, in SeaMonkey go to the Window menu and select the Mail and Newsgroups item. This will launch Messenger.

When you start SeaMonkey Messenger it is not configured to access your mail. To configure your DCS e-mail, go to http://www.cs.rit.edu/usr/local/pub/FAQ/Setting_Up_Seamonkey.html and follow the directions on setting up your e-mail account.

Once you have finished configuring your e-mail, you can ensure that it is working properly by selecting the RIT CS mail entry in the tree on the left-hand side of the browser window. If things are configured properly you will be prompted to enter your password as you login to the IMAP server. Enter the same password that you use to log into your UNIX account. After successfully logging into the IMAP server you should see a window that is similar to the one shown below:


SeaMonkey

Now take some time to familiarize yourself with sending and receiving messages using SeaMonkey. If you've never used SeaMonkey before, read through this short tutorial in the file called Auxiliary/usingNetscape.html. ( Firefox and SeaMonkey are amazingly similar. They were built from the same base of code! ) Send a message to yourself using your CS mail address. Verify that the message is received and reply to it. After you know how to send mail to yourself, find out the e-mail address of someone else in your lab section, and send them a message.

Working with Multiple E-mail Accounts

Many students have multiple e-mail accounts, and it is time consuming to check them all individually. One alternative to this is to arrange to have all your mail forwarded to one account that you check on a regular basis. If you do not wish to have your CS e-mail forwarded to another account, you may skip this section. Note: All official CS mail will be sent to your CS account. It is your responsibility to make sure that you read the mail sent to your CS account on a regular basis.

Many UNIX systems, including the CS department systems, are configured to use a .forward file to forward e-mail. The file must appear in your home directory and contain lines that list one or more forwarding addresses. To create a .forward file, simply follow the steps listed below:

Most e-mail systems provide you with ability to forward mail sent to them. If you have a DCE (RIT) account and wish to forward that mail to your CS account call the ITS Help Desk at (47)5-HELP for instructions.

Access from Outside of the Department

If you do not wish to read your CS e-mail from another machine you may skip this section.

The CS department runs a piece of software called an IMAP server. You can use it to access your CS e-mail from a machine anywhere on the Internet. E-mail messages are stored on a central computer that runs an IMAP server. An e-mail client program can connect to the IMAP server over the Internet to read and manage the messages stored on the server.

E-mail is delivered to a mail server using a protocol known as the Simple Mail Transport Protocol (SMTP). An e-mail client uses SMTP to contact an SMTP server to arrange to have the mail delivered.

Describing how to configure the particular e-mail client that you use to read your mail is beyond the scope of this document. However, we can provide you with the information that you will need when you configure your e-mail client. The IMAP server that you must use to access your CS e-mail is named mailhost.cs.rit.edu. If you are asked if the server uses a secure connection you should say yes. The user name and password for the IMAP server is the same login name and password you use to login to the CS machines.

The name of the SMTP server that you will specify depends on how you are connected to the Internet. If your machine is connected to an RIT network, then you should use the ITS SMTP server osfmail.rit.edu. The user name and password that you must specify when using this server are your DCE username and password. If you are using Road Runner you should use the server smtp-server.rochester.rr.com. Again the username and password you use to access the server are the ones provided to you by Road Runner. For other ISPs refer to their documentation for the name of the server to use.

Web Mail

You can also try a new experimental web interface to your email at https://webmail.cs.rit.edu/.

How To Submit

To finish this activity, send an e-mail message to your lab instructor. You must use the following line as the subject:

CS1 Lab 1 Activity 3 your full name

where you will replace the phrase "your full name" with your name. If you do not use the correct subject line you will not receive a grade for this portion of the lab. The text of the message should be a paragraph describing what you find interesting about computers and computer science. Also, tell your instructor what type of job you think you would enjoy after graduation.

Your mail message must be timestamped before the deadline for this lab. Do not wait until the last minute to do this. The mail server may get heavily loaded and take several minutes to process your message. There will be no excuses for late submissions.

Post-Lab Activity : Testing Your Knowledge of UNIX

Unix Beginner's Guide

Complete sections 3 and 4 in the Beginner's Guide (http://www.cs.rit.edu/~f2y-grd/beg-guide.pdf) and do all of the exercises. The Unix Reference Card (http://www.cs.rit.edu/~vcss231/Misc/unixRef.htm) may also be useful for finding commands to answer the questions in this activity.

To make sure that you understand how to use emacs and that you understand the UNIX commands you learned in this lab, we will ask to you to answer a few more questions. Fetch Auxiliary/questions to retrieve the file that contains the UNIX questions that you will answer in this activity. You should use the same basic steps that you used in activity 2 to retrieve the survey.

Open the file in emacs, and answer the questions.

How To Submit

When you are done, submit your work using the try command shown below:


try grd-231 lab1-2 questions
				

HINT: Use copy and paste to copy the try command required to submit your work into a UNIX window to save yourself the trouble of typing the command.


Grade Computation

Grade Breakdown: