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

Due Saturday, September 12, before midnight (US/Eastern local to Swarthmore)

The goals for this lab assignment are:

  • learn about the class

  • learn how to log into the CS lab remotely

  • gain some experience with unix commands

  • learn the basics of the emacs text editor

  • learn how to run our update21 and handin21 commands

  • practice using Slack

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:

You may also want to peruse our lab documentation page:

3. Connect to the CS labs remotely

To connect to the CS machines from your dorm room or off campus, you will need the ssh program on your machine. Follow the Remote access using ssh directions on the CS21 home page. Once you are able to connect, return to the next part of the lab.

If you have any problems with this step, you will not be able to continue. Please contact your professor or lab instructor!

4. Try running update21

Log into a CS lab machine using the methods described in the previous section.

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.

Once you are connected, your prompt probably looks something like this, though there might be another word instead of 'flamingo':

flamingo[~]$

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

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.

5. 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 the unix command line (there’s nothing you have to write or turn in). Make sure you understand the following commands:

  • ls list out files

  • cd change directory

  • pwd print working directory (where you are)

  • passwd change your CS password

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

  • cat show contents of file (all at once)

  • mv move/rename a file

  • rm remove a file

  • cp copy a file

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

6. Learn the text editor: emacs

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 emacs editor.

You should start by watching the Introduction to the emacs editor video.

Here’s the list of keyboard shortcuts featured in that video. Make sure you at least know how to open a new file, add text, and then save it to the correct directory.

After watching the video and reading through the keyboard shortcuts, practice using emacs by opening up the practice.py file in your cs21/labs/00 directory and then following the instructions in that file.

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

7. Edit the bio.txt file

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

$ emacs 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.

8. 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.

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!

9. Send a message in Slack

This semester we’ll be using Slack, a fancy text messaging application that we will use to facilitate discussions, run labs, send out clarifications, and post announcements that pertain to CS21. You should have received an email from us with a link to join SwatCS21-F20 on Slack. If not, or you’re having trouble joining, please email scout@swarthmore.edu.

For this first lab, just to get comfortable using Slack, choose at least one part of your bio.txt file above and post it to the #random channel. You can include where you are from, something else you are doing at Swarthmore, your entire bio, or whatever you feel comfortable sharing. You’re also welcome to include a photo of yourself, your hometown, or something that is meaningful to you to help us get to know you!

10. 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, run handin21 again.

11. Turning in your lab

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.

12. Logging out

When you are all done working on the lab, you can log out of the CS lab by typing "exit" or "logout" at the prompt in your terminal.

13. Come to Zoom Office Hours!

As part of your Lab 0 grade, you should participate in your professor’s office hours on Zoom. Your professor is the person who teaches you in the Zoom session during class time — not necessarily the instructor of record.

If you can come during our official office hours, that is ideal, but if you can’t make it at that time, send us a direct message in Slack or email us so we can set up an alternate time.

You do not have to have a specific question during office hours! You can just introduce yourself, and get more comfortable contacting us through Slack and Zoom.