CS21 Lab 0: Accessing the CS lab and using an editor

Due Saturday, September 9, before midnight

The goals for this lab assignment are:

  • learn about the class

  • learn how to log into the CS lab machines

  • gain some experience with Unix commands

  • learn the basics of the Visual Studio Code text editor

  • learn how to run our update21 and handin21 commands

  • practice using EdSTEM

Work through the following sections and ask if you have questions!

1. Read the class web pages

Start by reading through all of the 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 the class 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

From the CS homepage please read the user agreement and lab rules:

You may also want to peruse our lab documentation page:

3. Try running update21

Log into a CS lab machine and open a terminal window (click the terminal icon).

Your prompt probably looks something like this, though there will likely be a machine name other than flamingo:


As a shorthand, we will just use the $ symbol to indicate the prompt:


Our update21 command copies any files your professors want you to have from them to your cs21 directory. 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.

Enter each of these commands below at the prompt. Do not type the # or anything after that: those are just helpful hints to explain what you are typing.

$ 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 yes, it will print /home/your_username/cs21/labs/00

If update21 doesn’t work for you, please alert your lab instructor. It’s probably our fault.

4. Learn some UNIX

Read through our UsingUnix web pages and try the various Unix commands. These pages are just to help you get comfortable with BASH, a Unix command language and shell (there’s nothing you have to write or turn in). Make sure you understand the following commands:

  • ls list out files

  • cd change directory

  • mv move/rename a file

  • rm remove/delete a file

  • cp copy a file

  • pwd print working directory (where you are)

  • less show contents of file (one page at a time)

  • cat show contents of file (all at once)

  • passwd change your CS password

Optionally, you may also want to look over the ssh command:

  • ssh secure shell (how to connect to the CS machines remotely)

5. Learn the text editor: Visual Studio Code

Beginning this week we will start using the text editor in class, so you need to at least know the basics. All professors teaching this course will use the Visual Studio Code text editor. We will refer to Visual Studio Code by the nickname "v-s-code", and we will use the command code to run the editor.

To practice using vscode, open up the practice.py file in your cs21/labs/00 directory and then follow the instructions in that file.

$ cd cs21/labs/00        # unless you're already in the labs/00 dir
$ code practice.py

Here’s a list of keyboard shortcuts to help you learn the vscode text editor. Make sure you at least know how to open a new file, add text, and then save it to the correct directory.

6. Edit the bio.txt file

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

$ code 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 you make any major changes, and at the end of the day (before you log out) is a good habit to get into.

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/ directory!

8. Post to EdSTEM

This semester we’ll be using EdSTEM, an online Q&A forum for class discussion, help with labs, clarifications, and announcements that pertain to all sections of CS 21. Our EdSTEM page is https://edstem.org/us/courses/43921, and we have EdSTEM guidelines on the course home page.

For this first lab, just to get comfortable using EdSTEM, choose at least one part of your bio.txt file above to reply (non-anonymously) to the thread already created in EdStem. The title of the post is "Lab 0 - for section 8 post here". You can include where you are from, something else you are doing at Swarthmore, your entire bio, or whatever you prefer.

When posting your introduction, please post as a reply to thread already created, not as a new post to the forum.

9. Answer the Questionnaire

Each lab will have a short questionnaire at the end. Please edit the Questions-00.txt file in your cs21/labs/00 directory and answer the questions in that file.

Once you’re done with that, you should run handin21 again.

Submitting lab assignments

Remember to run handin21 to turn in your lab files! You may run handin21 as many times as you want. Each time it will turn in any new work. We recommend running handin21 after you complete each program or after you complete significant work on any one program.

Logging out

When you’re done working in the lab, you should log out of the computer you’re using.

First quit any applications you are running, like the browser and the terminal. Then click on the logout icon (logout icon or other logout icon) and choose "log out".

If you plan to leave the lab for just a few minutes, you do not need to log out. It is, however, a good idea to lock your machine while you are gone. You can lock your screen by clicking on the lock xlock icon. PLEASE do not leave a session locked for a long period of time. Power may go out, someone might reboot the machine, etc. You don’t want to lose any work!

Come to Office Hours!

As part of your Lab 0 grade, each student must visit the office of their lecture professor. If you can come during our official office hours, that is ideal, but you are also welcome to stop by any time we are around. You do not have to have a specific question, you can just drop by to introduce yourself and learn where our offices are. We will have sign in sheets to check you off.

  • Section 1/2 (Rich Wicentowski): Science Center 251

  • Section 3 (Andrew Danner): Science center 247