CS21 Lab 0: UNIX and the text editor

Due Saturday, January 21, before midnight

The goals for this lab assignment are:



1. Read the class web pages

Start by reading through all of your Professor's class web page:

Pay special attention to the Schedule, Academic Integrity, and How to succeed in CS21 sections!

You should get into the habit of checking this page weekly; the class topics, lab assignments, weekly readings, and announcements will be posted to the class schedule each week.

2. Read some useful CS web pages

Go to the CS homepage (https://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.

3. Run update21

Our update21 command just copies any files your professors want you to have, so it's a good habit to run update21 each time you log in. If you haven't run it already, this will create your cs21/labs/00 directory. Open a terminal window (click the terminal icon) and enter the blue commands below at the unix prompt (the dollar sign):

$ update21          # creates cs21 directory, with labs/00 dir below
$ cd cs21/labs/00   # cd into the correct directory for lab 00
$ pwd               # check to see that you are in the correct directory.
                    # if you are, it will print /home/your_username/cs21/labs/00

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.

4. Learn some UNIX

Read through our UsingUnix web pages and try the various unix commands. Make sure you understand the following commands: ls, cd, pwd, passwd, less, cat, mv, rm, cp, ssh

5. Learn the text editor

Beginning this Thursday or Friday we will start using the text editor in class, so you need to at least know the basics.

All professors teaching this course will utilize vim.


6. Edit the bio.txt file

For more practice with editing, and so we can learn a little bit about you, edit the bio.txt file in your cs21/labs/00 directory:

$ vim bio.txt

Note: this file should have a few simple questions in it for you to answer. If you don't see those questions, make sure you are in the cs21/labs/00 directory (i.e., run the pwd command), and/or run the update21 command to make sure you get the initial file from your professor.

7. Run handin21

Once you are satisfied with your bio.txt file, hand it in by typing handin21 at the unix prompt.

You may run handin21 as many times as you like. Each time you run it, new versions of your files will be submitted (i.e., any files you've made changes to). Running handin21 after you finish a program, after any major changes are made, and at the end of the day (before you log out) is a good habit to get into.

NOTE: handin21, will grab all files from your cs21/labs/00 directory. Each week, make sure you create your lab programs and files in the correct cs21/labs/XX directory!

8. Write a program!

Note: if you haven't learned any python in class yet, you may not be able to do this part in lab today. You should be able to finish this after the Thursday and Friday lectures.

Write a program called name.py that asks the user for their name and says "Hello", like this (what the user types is in blue):

$ python name.py 
Name: Jeff
Hello, Jeff!

To create and edit a new file called name.py, type vim name.py at the unix prompt.

Once you get your program running, turn it in by running handin21 again.

9. Answer the Questionnaire

Each lab will have a short questionnaire at the end. Please edit the README-00.txt file (vim README-00.txt) and answer the questions in that file.

Once you're done with that, run handin21 again.

10. Logging out

When you are all done working in the lab, you should log out of the computer you are using. First quit any applications you are running, like the browser and the Terminal. Then click on the logout icon logout 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 lock your machine while you are gone. You can lock your screen by clicking on the lock icon xlock.

Troubleshooting

If you can't find a file you created, check to see that you are in the correct directory.

If a file isn't in the correct directory, use the mv command to move the file from its current location (source) to a new location (destination): mv source destination

For example, if your bio.txt file is not in the correct cs21/labs/00 directory, here is one way to move it to that directory:

  $ mv bio.txt ~/cs21/labs/00/bio.txt