1. Due Date: Before First Lab

  • This lab will not be assigned a grade, but it contains instructions and tools necessary for starting lab and submitting Lab 1. You should try to complete it prior to the start of your lab session on Wednesday/Thursday.

  • We can assist you with questions on this lab, but if you have not started it prior to the start of your lab session, we will ask you to read this page while we first assist others that have done so.

2. Lab 0 Goals

  • Log in to your CS account remotely with ssh

  • Reset your password if necessary, especially for new Swarthmore CS students

  • Set-up course tools and resources, including Git, Piazza, and Slack

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

  • Learn the basics of the vim editor that you will use in Lab 1

3. New User Setup

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.

If you get stuck in the next two sections, we have added a short walkthrough video covering the steps below that may be of assistance:

4. 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 lab.cs.swarthmore.edu or to a particular machine by specifying the full name, e.g., machinename.cs.swarthmore.edu. For example:

# log into some lab machine:
ssh yourusername@lab.cs.swarthmore.edu
# log into owl:
ssh yourusername@owl.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. Please read the class webpage to get a general overview of the course.

5. Create a folder

All CS31 students should make a cs31 folder in their home directory after logging in via ssh. The Unix commands are shown below. For new students, it is strongly advised to go through the Using Unix material to learn the basic command line tools. In particular, you should familiarize yourself with the following commands now:

  $  cd                 # change current working directory to your home directory
  $  pwd                # print current working directory
  $  mkdir cs31         # create a new subdirectory named cs31
  $  ls                 # list contents of current working directory (your home directory)
  $  cd cs31            # change current working directory to cs31
  $  pwd                # print current working directory
  $  mkdir labs         # make a labs folder

Our help pages also include some information about the Unix directory structure.

6. Learning vim (and vi)

This section also has a short walkthrough video that may be of assistance if you get stuck getting started with vim:

The vi (and vim) editor is available on every Unix system. It is an efficient and lightweight text editor that is easy to use after learning a few basic commands, which you can learn by running though the vimtutor tutorial.

Even if you know another editor such as emacs or atom, it will be important to know the basics of vi/vim for CS31 and other systems CS courses.

vim is particularly useful when working remotely over an ssh connection.

vim also has many advanced features and is very configurable through, e.g., the use of a .vimrc file. However, just a few basic commands is enough to get you started.

Vim operates in two modes:

  1. insert mode: keystrokes are interpreted as inserts into the file contents at the point of the cursor.

  2. command or escape mode: keystrokes are interpreted as vim commands, which allow a user to do such things as saving, exiting, searching, or moving around in the file.

To switch from insert mode to command mode, press the ESC key.

There are many ways to switch from command mode to insert mode. One way is to press the i key.

To learn the vim editor, run vimtutor:

  1. ssh into our system and run vimtutor. Consult the help pages on remote access and ssh if needed.

  2. After creating a cs31 subdirectory in your home directory in the section above, change into this directory with cd:

      $ cd          # go to home directory from current directory
      $ ls          # list (ls) home directory contents
      $ cd cs31     # change directories (cd) to cs31 folder
      $ pwd         # print working directory to show full path

    From within your cs31 subdirectory run the vim tutorial:

      $  vimtutor     # start the vim tutorial
  3. Go through the sections listed below of vimtutor (the other sections cover more obscure features that are not necessary). It will take about 30 minutes to run through these lessons.

    • 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)

Optionally, you can configure vim for better course use. You can also consult the remote tools page throughout the semester for more information on using various CS31 tools.

Vim Resources and Links

7. Sign into Piazza and Slack

We will use both Piazza 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.

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 and start a Zoom session to which s/he will join.

  • #labX we will often move to Slack after starting each lab session on the course Zoom. Here you can get individual help on your lab work, and we will check in with each lab group. You can type in short questions, but typically we will have you start a /zoom session to which we will connect.

  • #ninja-sessions post help requests during ninja sessions here.

7.2. Start a Zoom session in Slack

First choose the Slack channel for the type of session, e.g., #labX, #office-hours, or #ninja-sessions. Start a Zoom session by typing /zoom. If you are working on a partnered lab one of you can start, and the other can join.

In zoom you can share your screen to display and run your code, or display your homework to your instructor.

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 and timezones. 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 direct messages with garbage. Try to make posts in academic channels concise.

  • Follow channel guidelines. E.g. do not post idle conversations in the #labX channel. The #random channel can be used for some non course specific content that may be of interest to the class.

  • Respect others’ time. When you are in lab, or office hours, try to respond promptly to messages directed to you.

  • 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 CS 35 at Swarthmore, you have used the same tool and you can skip the creation of ssh keys as long as you remember your ssh key passphrase.

Read the Git Overview and Setup and Configuration sections of the Git Help page, and then try cloning a copy of the Lab0 repo from the CS31 GitHub organization for our class.

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

If you get stuck in the next two steps, we have added two walkthrough videos covering the steps below that may be of assistance:

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.

cd cs31
cd labs
git clone git@github.swarthmore.edu:CS31-S21/Lab0-yourUserID.git
cd Lab0-yourUserID

8.3. Submit changes

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

git add README.adoc            # 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 References