This lab assignment should get you used to running update21b
and handin21b and give you some practice with Unix and editing files.
Start by reading through all of the CS21B homepage. Pay special attention to the
and How to succeed in this class
parts. You should get into the habit of checking this page weekly;
the class schedule, quizzes, lab assignments, weekly readings, and
announcements will be posted to the class Schedule weekly.
To begin the assignment, open a Terminal window. You do this by clicking on the black square in the toolbar at the bottom of the screen.
If you are in the Mac Lab (SCI 256) and there is no terminal icon in the toolbar, click on the magnifying glass in the upper-right corner of the screen and type in terminal. Click on the terminal icon that appears as a result of the search.
If you are in the Mac Lab (SCI 256) you'll need to do one additional step to log on to the CS machines. If you are in one of the CS Labs (SCI 238 or SCI 240) you can skip this step.
Inside the terminal window type the following, but replace username with your own username.
ssh -X firstname.lastname@example.org
The terminal window should have a prompt which will look something
Each machine in the CS domain has a cooking ingredient name. In this example it is lemon, but when you do this command you will most likely be on a different CS machine.
If you don't have one already, create a cs21b subdirectory in your home directory. Here is an example of the commands to enter to do this and to verify that it worked ('$' is the prompt and text after '#' are comments explaining the commands):
$ cd # change current working directory to your home directory $ pwd # print current working directory $ mkdir cs21b # create a new subdirectory named cs21b $ ls # list contents of current working directory (your home directory) $ cd cs21b # change current working directory to cs21b $ pwd # print current working directoryHere is some information about the Unix directory structure.
In the terminal window start the editor as follows:
A new editing window will open. Click on the Help menu and select Emacs Tutorial. Start reading from the top. You can stop when you get to the section on buffers. This tutorial will take about 20-30 minutes to complete.
I have created a short Emacs Summary to help you remember the most frequently used commands. You may want to print this and bring it with you to class the first couple of weeks.
Note: if you added CS21b late, we may not have you in our list of students who can run update21b and handin21b. Send me email if you have problems and I'll add you to our list so that these will work for you.
Once you have learned how to use emacs, run update21b to get the starting directory for the initial lab, then change into that directory:
$ update21b # creates subdirectory 00 in your cs21b/labs directory $ cd # cd into your home directory $ cd cs21b/labs/00 # cd into the directory for lab 00 $ ls # list the files in this directory, should contain bio.txtFor this lab, the program handin21b will only submit files in this labs/00 directory.
Next, start up the editor and open the file
$ emacs bio.txt
Before you begin answering the questions, you can set up emacs so that it will automatically fill each line with the appropriate number of words. Press Esc-x, type auto-fill-mode, and then press Enter. You should see at the bottom center of the emacs window the word Fill appears.
After you are done editing your
bio.txt file, save your
changes and exit from emacs. Run the cat command on the file
to catalog it's contents to the terminal window:
$ cat bio.txt
Once you are satisfied with your
bio.txt file, hand it in by typing
handin21b at the unix prompt.
You may run handin21b as many times as you like, and only the
most recent submission will be recorded. This is useful if you realize
after handing in some programs that you'd like to make a few more
changes to them.
Don't forget to attend a Using UNIX session.
You can attend either one of these sessions (they are identical):
Tuesday, Jan. 18, 4-5pm, SCI 240
Wednesday, Jan. 19, 8-9pm, SCI 240
If you can't find a file you created, check to see that you are in the directory you think you are.
# moves bio.txt from current directory into your cs21b/lab/00 directory $ mv bio.txt ~/cs21b/lab/00/bio.txt # this does the same thing, '.' means a file with the same name as the source $ mv bio.txt ~/cs21b/lab/00/.