This lab assignment should get you used to running
update21 and handin21.
and give you some practice with Unix and vim.
Start by reading through all of the CS21 homepage.
Pay special attention to the Schedule,
Academic Integrity and
How to succeed in CS21 parts. You should get into the habit of
checking this page weekly; the class schedule, lab assignments,
weekly readings, and announcements will be posted to the class Schedule
weekly.
Go to the CS homepage
(http://www.cs.swarthmore.edu/
).
From there click on the "cs lab help" button and read the
Welcome Message,
The User Agreement,
and The CS Lab Rules pages.
To begin the assignment, open a Terminal window. You do this by clicking on the black square in the bottom toolbar
When the
Terminal window opens, you will see the shell prompt which
will look something like this:
lemon[~]$
In the above prompt, lemon is the name of the machine you are working on, so this may be different for you if you are working on a different machine.
If you don't have one already, create a cs21 subdirectory in your home directory and set the permissions so that only you can access it. Here is an example of commands to enter to do this and to verify that it worked ('$' is the shell prompt and text after '#' are comments explaining the commands):
$ cd # change current working directory to your home directory $ pwd # print current working directory $ mkdir cs21 # create a new subdirectory named cs21 $ ls # list contents of current working directory (your home directory) $ cd cs21 # change current working directory to cs21 $ pwd # print current working directoryHere is some information about the Unix directory structure.
In your cs21 directory run the vim tutorial to learn how to edit files in Unix.
$ vimtutor # start the vim tutorialJust go through the following sections of vimtutor (the other sections cover more obscure features that you will not need to use):
* all of Lesson 1 (moving around, x, i, A, :wq) * Lesson 2.6 (dd) * Lesson 2.7 (undo) * Lesson 3.1 (p) and 3.2 (r) * Lesson 4.1 (G) and 4.2 (searching) * Lesson 6.2 (a), 6.3 (R), and 6.4 (y and p)This tutorial will take about 20-30 minutes.
note: if you added CS21 late, we may not have you in our list of students who can run update21 and handin21. 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 a Unix editor program, run update21 to get the starting directory for lab 0, then cd into that directory:
$ update21 # creates subdirectory 00 in your cs21/labs directory $ cd # cd into your home directory $ cd cs21/labs/00 # cd into the directory for lab 00 $ pwd # check to see that you are in the correct directory # if you are, pwd should list: /home/your_user_name/cs21/labs/00The lab submision program, handin21, will grab files from your labs/00 directory.
Next, start up vim (or vi) and open a new file named
bio.txt
and answer these questions:
To start editing the file:
$ vim bio.txt
After you are done editing your bio.txt file, save your changes, exit vim
(:wq in escape mode), and enter the ls
command to list the
file bio.txt
. You can also run the cat command on the file
to list it's contents to the terminal window:
$ cat bio.txt
Once you are satisfied with your bio.txt file, hand it in by typing handin21 at the unix prompt.
Here is some information about how to run handin21.
You may run handin21 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.
After you have submitted your bio.txt file, sign up for a time to
come meet with me. The sign-up sheet is outside my office
door (249 Sci Cntr).
Don't forget to attend a Using UNIX session.
You can attend any one of these sessions (they are identical):
Tuesday, August 30, 4-5pm in Rm 240
Wednesday, August 31, 8-9pm in Rm 240
When you are done working in the lab, you should log out of the computer you are using. To do this, clicking on the XFCE menu icon and choose "log out".
If you plan to leave the lab for just a few minutes and then come right
back to work, you do not need to log out, but it is a good idea to xlock
your machine while you are gone by clicking on the xlock icon
.
You should not xlock a machine if you
plan to be gone for more than about 10 minutes, and you should not xlock main
lab machines during times when classes are held in the lab.
If you can't find a file you created, check to see that you are in the directory you think you are.
# moves bio.tx from current working directory into my cs21/lab/00 directory $ mv bio.txt /home/soni/cs21/lab/00/bio.txt # this does the same thing, '.' means a file with the same name as the source $ mv bio.txt /home/soni/cs21/lab/00/.