1. Due Date

  • This lab will not be assigned a grade, but it contains instructions and tools necessary for starting and submitting Lab 1. You should complete it prior to the start of Lab 1 next week.

  • Next week during lab we can assist you with questions on this lab, but if you have not started this lab prior to the start of Lab 1, we will ask you to work through this on your own while we first assist others that are stuck on Lab 1.

2. Lab Goals

  • Log into the CS lab machines

  • Reset your password, if necessary (or if you’re a new Swarthmore CS student)

  • Learn the basics (or refresh your knowledge) of Unix and useful Unix commands/tools

  • Learn the basics of a text editor (vim, emacs, atom or vscode), if you don’t already know one

  • Set up your directory structure for CS31 course work.

  • Set up course tools and resources, including ssh, git, Ed, and Slack

3. CS Account Setup

If you already have a CS user account you can reset your password here. You can skip the rest of this section.

All work for CS31 will be done using your CS user account. If this is your first CS course at Swarthmore, you should have received an email from our system administrator, Jeff Knerr, with your username and a link to reset your initially random password. Please follow the directions to set/reset your password for your CS account.

4. Getting help with SSH and Unix

If you get stuck in the next two sections, you can watch a short walkthrough video covering the steps below that may be of some assistance. Note: this video was made in preparation for the all-remote Spring 2021 semester. There is one important change that you need to make for this semester:

  • Scout Brody references logging into lab.cs.swarthmore.edu. However, you should log into cslab.cs.swarthmore.edu

4.1. SSH login

ssh is useful for remotely logging into the CS lab machines. If you have never used ssh before, you may need to install an ssh client to connect to the CS machines from your home computer. More details can be found on the remote access help page.

You can remotely connect to a CS lab machine by sshing in with your username to cslab.cs.swarthmore.edu or to a particular machine by specifying the full name, e.g., machinename.cs.swarthmore.edu. For example, if your username was dduck1, you would say:

# log into some lab machine if your username was dduck1
$ ssh dduck1@cslab.cs.swarthmore.edu

# log into oregano if your username was dduck1
$ ssh dduck1@oregano.cs.swarthmore.edu

The CS help pages have a list of valid cs lab machines.

Using your ssh client, try connecting to the CS network using your CS username and CS password. Note that your username is probably the same as your ITS username, but your password may be different. You can always request a CS password reset online.

Once you have connected to the CS network via ssh, you are ready to practice some of the CS31 specific tools.

5. Create a folder

In this section we will setup a directory to store your CS31 work. We will start by creating a cs31 directory. Then we will move into the cs31 directory and create the inlab and labs directories.

Most weeks you will copy over some example code that we will talk through and practice in lab. These examples are related to the assigned lab, so remember to refer back to them, and back to the appropriate webpage, as these can be helpful resources when working on lab assignments. These examples will be stored in the inlab subdirectory that we will create below.

In addition to the work we do together in lab, you will also need to work that week’s lab assignment. You will store your lab work in the labs subdirectory that we will create below.

Your directory structure for cs31 will look something like this:

              /
              |
          ------------
         /    |       \
     ...    home      ...
              |
          -------------
         /    |        \
     ...     you        ...
              |
        ------------------
       /      |           \
    ...     cs31           ...
              |
         -------------------
        /                   \
     labs                   inlab
      /                          \
   ...                          ...

Follow along with these steps.

Do not type the $, that is the unix prompt. Comments about the command are after #.
$ cd                     # cd with no argument switches to your home directory (/home/you/)
$ mkdir cs31             # create a directory named 'cs31'
$ cd cs31                # cd into cs31 (change current working directory to cs31)
$ pwd                    # print the current directory name
/home/you/cs31           # the shell will respond with your current location
$ mkdir labs             # create a 'labs' directory
$ mkdir inlab            # create an 'inlab' directory

If you are new to Unix, there is a Using Unix guide on the CS Swarthmore help pages that contains some helpful information: https://www.cs.swarthmore.edu/help/basic_unix.html.

6. Using an editor (remotely)

Throughout the semester, you will be editing many files. You may already know how to edit files with emacs, vim, atom, vscode, or some other editor. In this class, you can use any editor that you want to complete your assignments.

Although you are welcome to use whatever you want in this class, some upper-level systems courses (most notably, Operating Systems) will require you to learn the basics of vim. If you don’t know vim, you may want to follow the instructions below, which covers basic usage of vim using vimtutor. You do not need to become proficient at vim, but it is a good idea to know enough so that you can open a file with vim, make small edits, save those edits, and then exit.

If you are already comfortable with using an editor remotely, you can skip the remainder of this section.

Below are links to learn how to use atom and vim. You only need to learn one. If you are unsure which to choose, follow the instructions for using atom.

7. Sign into Ed and slack

We will use both Ed and Slack to help answer questions and post announcements. You should have received email invites to each service. Please sign in to both accounts and let us know early if you have any trouble connecting.

We will use Slack during the asychronous week and during the remote lab meeting next week. When we are able to meet in person, we won’t be using Slack very much, if at all. The primary way for you to ask questions, and the primary way that instructions will post announcements and class slides, will be through Ed.

7.1. Navigating Slack

Slack breaks up workspace into channels, which are listed in the sidebar on the left. Some channels we will use in this course are:

  • #announcements for general announcements about the class, and pinned shortcuts to other course resources.

  • #office-hours for class office hours. You can send a quick message to the professor here during scheduled office hours.

  • #lab will be used only for lab sessions that are held remotely (e.g. Lab 0 and Lab 1). You can ask for individual help on your lab work, and we will check in with you. You can type in short questions, but typically we will have you start a /zoom session to which we will connect.

  • #random for interesting things related to class that you’d like to share with everyone.

7.2. Start a Zoom session in Slack

You can start a Zoom session by typing /zoom. Since the invitation will be open to anyone who can read the forum you type this into, you should restrict typing /zoom to direct messages. This first time that you use zoom in Slack, you will need to give approval to connect zoom to Slack. After you have approved it once, you should not need to do so again.

7.3. Accessibility

The course staff is committed to making all course material accessible to you. To access Slack’s accessibility settings, start by clicking on the workspace name at the top of the navigation pane on a laptop or desktop.

Then from the dropdown menu choose “Preferences”, and select “Accessibility” from the navigation bar on the left.

Options include:

  • Content magnification ("Zoom"). Allows you to enlarge content shown in Slack

  • Animation. Please uncheck this box if you are sensitive to animated images.

  • Keyboard. Options for non-mouse navigation.

7.4. To direct message someone

By default, messages posted on Slack are visible to all members of the workspace. But for smaller conversations, you can use Slack’s direct messaging (DM) feature to start a private conversation with one person or a small group.

7.5. Code of Conduct

The course Slack workspace is accessed by a wide variety of people all working in different environments. We ask that you be respectful of the staff as well as your fellow students. We expect you to follow these general rules:

  • Do not use Slack to harass faculty, staff, or other students.

  • Do not spam any channels or send direct messages with garbage.

  • Try to make posts in academic channels concise.

  • The #random channel can be used to share course-related (but not lab/homework specific) content that may be of interest to the class.

  • Note that any messages you post in a channel will be visible to everyone in that channel. Think before you post, especially when asking questions that might reveal a solution.

If there is a problem where someone is violating the code of conduct or otherwise failing to respect others, please raise the issue to one of the course instructors.

8. Set up your Swarthmore GitHub account

We will be using Swarthmore’s GitHub Enterprise to get and submit lab assignments. If you previously took CS35, you have used the same tool and you can skip the creation of ssh keys as long as you remember your ssh key passphrase.

If you are new to git, read the Git Overview and Setup and Configuration sections of the Git Help page.

All Swarthmore students should have a Swarthmore GitHub account connected to your ITS username and password. You can login to do some of the initial setup steps at https://github.swarthmore.edu/.

Briefly, before using Swarthmore’s GitHub Enterprise, you’ll need to complete some one time setup steps. Once you’ve done that, you should follow steps to clone your Lab 0 repo from the CS31 GitHub organization for our class.

A more detailed explanation is provided below. If you get stuck on the next two steps, there are two walkthrough videos covering the steps below that may be of assistance.

Both videos were created for the Spring 2021 all-remote semester. All of the content is the same for this semester with the following small change: Prof Danner references the CS31 organization name which was CS31-S21 in the Spring 2021 semester. This semester, the organization name is CS31-S22.

8.1. Add SSH keys

If this is your first time using the college’s GitHub server for CS, follow the ssh-keys and config steps link from the Setup and Configuration directions for information on how to generate ssh keys and upload your public ssh key (generated from your CS account) that is necessary to clone repos on our system. Make sure you are logged into the CS network via ssh before creating your keys. It is possible, particularly on a Mac, to create keys just for your home machine/laptop, but that is not the goal here. Add your public key as a new SSH key on your Swarthmore GHE key settings.

8.2. Clone Repo

Once you have added your key, you should be able to clone your repo on the CS network. This step will fetch a copy of the files from GitHub and copy them to your labs folder on the CS network. Replace userID below with your username.

$ cd
$ cd cs31
$ cd labs
$ git clone git@github.swarthmore.edu:CS31-S22/Lab0-userID.git
$ cd Lab0-userID

8.3. Submit changes

If you successfully cloned the Lab0 repo, open the README.md file in an editor and follow the directions for editing the file and then committing and pushing your changes using git.

$ git add README.md                            # make this file part of next commit
$ git commit -m "updated readme documentation" # locally record changes with message
$ git push                                     # send changes to GitHub

NOTE: you will not be able to access our course GitHub org or your Lab0 repo until Monday afternoon.

We will go over these steps in lab on Wednesday, but please try this on your own before lab. We will help you during lab if you get stuck completing these steps.

You will need to remember to add, commit, and push each time you want to submit something for a grade. The push command sends files that have been added and committed to the GitHub servers, which is where graders and staff have shared access to your files. There is no grade for Lab0, but it is a chance for you to practice the steps needed for future labs. You can log into GitHub and check on your repo to see if your changes are there. If they are on GitHub, you did the steps correctly.

9. Handy Resources