Fall 2000

Lab 1: Introduction

CS61C 

Purpose:

This is an introductory lab. Some of you will find this easy and trivial , but we want to make sure everybody knows how to get started. In this lab you will learn: Lab policy: You may work in groups of two students, but both students should individually fill out the survey at the end of lab. You CAN help and speak with other students and other groups. Tentatively, the check-off of any lab is due at the beginning of the successive lab (this may change). For the check-off, you will demonstrate a working lab to your TA to receive credit.

How to log in:

In order to log into an instructional machine you need to have an instructional account. See your TA if you don't have one already. You are provided with two things: a login (e.g. cs61c-td) and a secret password (e.g. mtsh34op [no, it is not my password :O) ]).
Just follow the instruction on the monitor to log in. You will be required to type your login (in clear) and then your password (it will not appear on the monitor to prevent people around you from seeing it). We're not sure how you can read these instructions if you haven't logged in.

How to register for this class:

After you have logged in you will be in the Xwindows UNIX environment. After you're logged in, you should have an open console; if you closed it by mistake you may open a new xterm (double-click on the Xterm icon).
Follow the instructions to register your name and SID. You will have to enter some information twice. Do not hesitate to ask your TA an help. If you enter it incorrectly, type "re-register" (type the dash, but do not type the quotes).
It is very important that you register!!! Please do it NOW before proceeding!

IMPORTANT: after your registration you MUST change your password for security reasons.
Type "ssh po.eecs.berkeley.edu". (You are connecting to a remote machine in order to change your password).
Type "passwd" and follow the instructions carefully.

Exit from po to return to your local machine, po is a old slow machine; it is better (and faster) for you to work on the local machine. To leave po, type "logout". Secure Shell, commonly shortened to ssh, allows you to securely access a remote machine. It is a significant improvement over the older, highly insecure telnet program. EECS Instructional machines may only be accessed via secure means like SSH. You can get a copy of SSH for your home computer here.

How to use e-mail:

The UNIX version of Netscape can be used as a standard e-mail client. In this lab we will learn how to use pine.

Open an xterm as described in the previous section. Type in "pine" and then the enter key. Your screen should look approximately like this:

This is the pine interface

To access the list of your e-mails press "I"
You can browse your messages with the navigation keys. To read one message select it using the navigation keys and then press enter. The message will be displayed. You can scroll with the navigation buttons.
If you want to write an e-mail to a friend you should press the "C" key from the main menu OR from the e-mails list page. Your screen should look like this now:

this is the compose message screen

The fields are self-explanatory. You provide the e-mail of the person you are writing to in the field "To", the title of the message in the "Subject" field, and the body of the message under it. As always, use the navigation key to move among the fields.

Task 1: write an e-mail to a person sitting near you.

You should be able to write an e-mail to your fellow student now.
Your e-mail address is your login followed by "@cory.eecs.berkeley.edu". For example if your login is "cheese" your e-mail address is cheese@cory.eecs.berkeley.edu. However, if you are writing to people with the same domain as you, simply type in their login in the "to" field (i.e. cheese).
Write him/her an e-mail titled "this is a test"; then ask him/her to read your message.
Your TA is here to help you. Do not hesitate to ask.

How to use newsgroups

The UNIX version of Netscape can be used as a standard newsgroup client. In this lab we will learn how to use tin.

Open a console as described in the registration section. Type "tin" and then the enter key. Your screen should look like this:

This is the tin interface

To access the list of all the available newsgroups press the "y" key.
You can browse the newsgroups with the navigation keys. To subscribe one of them press "s", to unsubscribe use "u".

Press "q" to quit. To access a newsgroup simply select it from the main page with the navigation keys and press enter. Select the article you want to read with the navigation keys and then press enter to view it.

Task 2: subscribe the ucb.class.cs61c newsgroup

You should be able to do it now!
Your TA is here to help you. Do not hesitate to ask.
Task 3: navigating the newsgroup Steve Tu, one of the friendly 61C TAs has posted a message to the newsgroup. The newsgroup may be a little cluttered since it might not have been cleaned out from the summer session as of yet. Try to read Steve's article.
Your TA is here to help you. Do not hesitate to ask.
If scrolling down takes too long, you can use pgUp and PgDn keys

Write, compile and run a simple C program

A C program is constituted by one or more files. The program we are going to write is really simple. It will be contained into a simple C file.

Open a console and type "emacs first.c". Emacs is a program that allow you to edit text files. You need to know two things:

Press Ctrl + X + C to Save AND exit
Press Ctrl + X + S to simply save
This is the code of your first program (simply copy it now):
#include <stdio.h>

int main() {

  printf("\n\nHello World!!!\n\n");
  return 0;

}

After you have done it save and close the EMACS window (Ctrl+ X + C). Now you have written your first C program. Try to type "ls" to see the list of all the file in your current directory.
A C program is a text file. You cannot execute it. You need to compile it and produce an executable file. In order to do it simply type "gcc -o hello first.c". Type "ls" after the compilation finished, you can see the compiler had produced a new file called "hello". You can execute it now, just type "./hello".

Task 4: Your first C program

Follow the instructions of the precedent paragraph and write, compile and execute the "hello world" program.

Task 5: CS 61C Course Survey #1

Go to the CS 61C course home page located at http://www-inst.eecs.berkeley.edu/~cs61c/, and fill out the course survey linked from the News section of the page. Feedback: Please send your comments about the content and the format of this first lab to: cs61c-tc@cory.eecs.berkeley.edu (you should be able to do it now). Last updated: 8/29