CS210 · Block 1 · Lesson 1

Course Intro and Toolchain

Linux VM · VSCode · gcc · Hello World · Git basics
At a glance: Set up your C development environment, write and compile your first program, and learn the Git commands you will use every lesson. Setup work happens before class; we walk through the concepts and your first compile in class together.
Contents
  1. Lesson Objectives
  2. Assigned Readings
  3. Pre-Class Work
  4. Lesson Materials and Overview
  5. In-Class Work
  6. After Class
1. Lesson Objectives

By the end of this lesson, cadets will be able to:

  1. Configure a working C development environment using the CS210 Linux VM, VSCode, and gcc. (Outcome 7)
  2. Compile and run a basic C program from the command line. (Outcomes 2, 7)
  3. Use Git to clone a repository, commit changes, and push to a remote. (Outcome 7)
2. Assigned Readings

Complete before class. These are short and set the vocabulary we will use.

Source Sections Why
Ubuntu CLI Command Line for Beginners — Steps 1 to 3 (skip the later scripting sections) What the terminal is and how to use it
Beej-C Chapters 1 to 2 (Foreword, Hello World) Orientation and your first C program
Beej-Git Chapters 1 to 3 (Foreword, Git Basics, GitHub: How To Use It) Clone, commit, push fundamentals
3. Pre-Class Work
Do this first
Work through the setup checklist before our first meeting. Plan on 45 to 75 minutes the first time. If something goes wrong, write down where it failed and bring that note to class. You will not be the only one stuck.

Toolchain Setup Checklist

Run each verification command in your VM's terminal. The expected output gives you something concrete to compare against. If your output looks substantially different, that step failed and the rest will not work until you go back and fix it.

1
Install VMware Workstation Pro and the CS210 VMs
CS210 uses a department-provided Linux VM as your development environment. Running everyone in the same VM means when your code works on your machine it works on the grader's machine. The hypervisor is VMware Workstation Pro, which is free for personal use but requires a Broadcom account to download. Plan on 30 to 45 minutes for this step the first time, plus download time for the VM images.
1a. Create a Broadcom account
Go to broadcom.com, click the LOGIN dropdown at the top right, and choose REGISTER. Create your account and then sign in.
1b. Download VMware Workstation Pro
While signed in, navigate to Desktop Hypervisor Solutions and click DOWNLOAD NOW. You should land on a Broadcom page titled My Downloads. If you do not see it, click "Free Software Downloads available HERE".
Find the VMware Workstation Pro link near the bottom of that page, or search for it by name. On the product page, select the latest Windows release.
Open the Terms and Conditions link to un-grey the agreement box, then check the box. The download link will appear on the right. You will likely be asked for your address (export-control compliance) before the .exe installer download starts.
Heads up: Broadcom's pages change layout occasionally. If a link name looks slightly different from what is described here, follow the closest match. If you are stuck for more than a few minutes, bring a screenshot of where you got stuck to class.
1c. Install VMware Workstation Pro
Run the installer and accept the defaults. If the installer offers Windows Hypervisor Platform (WHP), enable it. WHP is required (alongside Hyper-V) to run both WSL and VMware on the same machine.
1d. Download the CS210 VM image
Download the Hosts VM (about 2.77 GB zipped, 2.81 GB unzipped). This is the Linux development environment you will use all semester.

Download Hosts VM → SharePoint, opens in a new tab

Unzip the archive to a folder you can find later (something like C:\CS210\VMs\). You may see a Routers VM listed alongside the Hosts VM on SharePoint; you will not need it for CS210.
1e. Open the Hosts VM in VMware
Launch VMware Workstation Pro. From the menu, choose File > Open, navigate to the unzipped Hosts folder, and select the .vmx file. The VM should appear in your library. Click the green Play button to boot it. If VMware asks whether you moved or copied the VM, choose I Copied It.
Log in with the credentials provided on Blackboard and change your password on first login.
Verify (run inside the VM terminal):
$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.x LTS  (or newer)
$ uname -a
Linux cs210-vm 5.x.x ... x86_64 GNU/Linux
2
Install the build tools
In your Ubuntu terminal, install the full toolchain in one shot:
$ sudo apt update
$ sudo apt install build-essential gdb valgrind git
This installs four things you will use throughout the course:
  • build-essential — gcc (the C compiler) and make (the build automation tool you will meet in Lesson 7)
  • gdb — the GNU Debugger, used to step through your code and inspect program state when something goes wrong
  • valgrind — memory error detector you will use heavily in Block 2
  • git — the version control system you will use every lesson
Verify:
$ gcc --version
gcc (Ubuntu ...) 11.x.x or later
$ make --version
GNU Make 4.x
$ gdb --version
GNU gdb (Ubuntu ...) 12.x or later
$ valgrind --version
valgrind-3.x
3
Install VSCode inside the VM
VSCode is the editor you will use for the rest of the semester. It runs inside your VM, alongside your code and toolchain, so everything you do happens in one consistent Linux environment.
3a. Install VSCode
Download the .deb package from code.visualstudio.com using Firefox inside the VM, then install it from your terminal:
$ cd ~/Downloads
$ sudo apt install ./code_*.deb
3b. Install the required extensions
Launch VSCode from your applications menu or by running code in the terminal. Click the Extensions icon in the left sidebar (or press Ctrl+Shift+X), and install:
  • C/C++ (publisher: Microsoft) — syntax highlighting, IntelliSense, and debugger integration
  • C/C++ Extension Pack (publisher: Microsoft) — bundles useful companions like CMake Tools (optional but recommended)
3c. Open a project folder
From your terminal:
$ cd ~
$ code .
Verify:
VSCode opens. The integrated terminal (View > Terminal)
opens a bash shell. Running 'gcc --version' inside that
terminal returns the same gcc you verified in step 2.
4
Configure Git with your identity
Git tags every commit with your name and email. Set them once, globally:
$ git config --global user.name "Last, First MI"
$ git config --global user.email "your.email@afacademy.af.edu"
Verify:
$ git config --global --list | grep user
user.name=Last, First MI
user.email=your.email@afacademy.af.edu
5
Create a GitHub account (if you do not already have one)
Sign up at github.com. Use a username you would not be embarrassed to put on a resume; you may keep this account after graduation.
Verify:
You can sign in at github.com and see your profile page.
6
Get yourself oriented to the command line (Script Doggies, pages 1 to 3)
CS210 is the first course where you will live in a Linux shell. Before class, work through the first three pages of Script Doggies, a clickable filesystem-tree tutorial. Plan on 30 to 40 minutes total. The point is to arrive with cd, paths, and basic file operations already in your hands so we can move faster in class.
  • Path Practice — learn how a filesystem is laid out as a tree, and how a path names a node in that tree. About 10 minutes.
  • Command Practice — the everyday Linux commands (pwd, ls, cd). About 10 minutes.
  • Move & Copy Filesmv, cp, and rm. About 15 minutes.
Verify:
You can complete all three pages without getting stuck. Pages 4 and 5 (Dwarf Mine Terminal and Typing Practice) are optional and listed in the After Class section as ongoing practice.
4. Lesson Materials and Overview

The setup you did has a story behind it. This section contains the concepts and reference material for the lesson: the slides we will use, the compilation pipeline that explains what gcc actually does, your first C program, and the Git workflow you will use every day. The hands-on practice with these commands lives in Section 5.

Jump to
Slides CLI Commands Compilation Pipeline Your First C Program Git Workflow Example Code DFCS Standard

Slides

The Lesson 1 deck covers course orientation, the toolchain, the compilation pipeline, and a live demo of writing and compiling hello.c. The slides are the spine of the in-class hour; the reference material below is the persistent companion you can return to any time.

Open Lesson 1 slides → opens in a new tab

Common Command-Line Commands

A reference for the commands you will use every day at the terminal. The Ubuntu reading covers what a terminal is; the table below is the quick lookup for what each command does. The practice terminals in Section 5 drill these.

Command Example What it does
pwd pwd Print working directory (where am I right now)
ls ls -la List files in the current directory (-l long format, -a include hidden)
cd cd cli_lab  cd .. Change directory (.. goes up one level, ~ jumps home)
mkdir mkdir cli_lab Make a new directory
touch touch notes.txt Create an empty file
cat cat hello.c Print the entire contents of a file to the terminal
head / tail head -n 5 file Print the first or last N lines (default 10)
echo echo "Hello" Print text to the terminal
> (redirect) echo "hi" > f.txt Send command output to a file instead of the terminal (overwrites)
cp cp src.txt dst.txt Copy a file
mv mv old.txt new.txt Move or rename a file
rm rm notes.txt Remove a file (use -r for directories — permanent, no recycle bin)
man man ls Manual page for any command (press q to quit)
clear clear Clear the terminal screen

Tab completion saves enormous time at the terminal: start typing a filename or command and press Tab. The shell completes it for you when there is only one match.

The Compilation Pipeline

In Python, you ran python hello.py and the interpreter executed your code line by line. C does not work that way. Your .c source file must be translated into a machine-executable file before it can run.

When you type gcc hello.c -o hello, four phases happen in sequence:

1. PREPROCESS Resolve #include and #define directives, producing pure C with no preprocessor lines left.
2. COMPILE Translate that C code into assembly language for your target CPU.
3. ASSEMBLE Translate the assembly into machine code (an object file, .o).
4. LINK Combine your object file with the C standard library and any other objects to produce the final executable.

We will dig into this pipeline in Lesson 7 when we introduce Make. For now, gcc handles all four phases for you with a single command.

Your First C Program

Create a file called hello.c with the following contents:

#include <stdio.h>

int main(void) {
    printf("Hello, CS210!\n");
    return 0;
}

Compile and run:

$ gcc hello.c -o hello
$ ./hello
Hello, CS210!

A few things to notice that we will return to repeatedly. Every C program starts at main. Statements end in semicolons. The return 0; at the end signals success to the operating system. The \n inside the string is a newline character; unlike Python's print(), printf does not add one for you.

The Git Workflow You Will Use Daily

Git is the version control system the entire software industry uses. Every assignment in CS210 lives in a Git repository, and you will go through this same five-command loop dozens of times this semester. Memorize it now.

Command What it does
git clone <url> Download a repository to your machine. Once per assignment.
git status Show what has changed since your last commit. Run this often.
git add <file> Mark a changed file to be included in the next commit.
git commit -m "msg" Save a snapshot of your staged changes with a short message.
git push Send your local commits up to GitHub.

Commit early, commit often. A commit every 15 to 30 minutes of work is a good rhythm. Cheap, frequent commits make it trivial to roll back when something breaks.

Example Code

Add example code links here. The hello.c snippet above is the only code we touch in class today; longer examples will live in a course GitHub repo. When that repo is set up, replace this callout with a link such as <a href="https://github.com/...">Lesson 1 examples</a>.

DFCS C Programming Standard

CS210 follows the DFCS C Programming Standard for all code you write in this course. The standard is short and practical; you will meet a few sections at a time as new C concepts come up. Lesson 1 introduces three pieces:

  • §2.1 Comment header block. Every C file you turn in starts with a header comment naming the file, the author, and a one-line description. The starter hello.c in your lab repo already shows the format.
  • §3.1 Line length. Keep lines at 100 characters or fewer. Long lines are hard to read in a terminal and hard to review on GitHub.
  • Compile-flag rule. Build with gcc -Wall -Werror from Lesson 1 onward. -Wall turns on the warnings that catch most bugs; -Werror turns those warnings into errors so you cannot ignore them. The autograder uses the same flags.

The full standard is in the course Resources section. You do not need to read it cover to cover; treat it as a reference you check when a question comes up.

5. In-Class Work

Five things to do in the remaining class time. Use this checklist to track your progress. Anything not done in class should be completed as homework before Lesson 2.

  • Finish your toolchain setup. If anything from Section 3 (Pre-Class Work) is still broken, fix it now while you have help available.
  • Work through the Filesystem CLI Walkthrough. Sixteen tasks. Builds your mental model of the filesystem as a tree and gives you the daily Linux commands in your hands. Embedded below.
  • Work through the Git Workflow Practice. Nine tasks. Walks the daily five-command Git cycle (status, add, commit, push, plus clone) end to end. Embedded below.
  • Complete Lab 01: Hello World. Your first push to GitHub. Accept the assignment from the link below; full instructions live in the repo README.

    Accept Lab 01 on GitHub Classroom →

  • Submit the Lesson 1 reflection. As soon as both widgets are complete, open the Lesson 1 reflection in Blackboard. Enter the two completion codes from your widget screenshots, answer the short reflection prompt, and submit. Best done right after the widgets while the experience is fresh.

Practice Terminal 1: Filesystem CLI Walkthrough

Sixteen tasks across four sections: locating yourself in the filesystem, paths two ways, navigating up and sideways, and building your CS210 working folder.

Before you begin

Enter your name. It will appear on the completion screen so you can include it in your screenshot for the Blackboard reflection quiz.

CS210 Lesson 1 · Filesystem CLI Walkthrough

A guided tour through the Linux filesystem. The terminal is on the left, the tree of where you are is on the right. Type each command and watch the tree light up.
Task 1 of 16
SECTION 1: WHERE AM I?
TASK 1 OF 16
Find out where you are in the filesystem. Print the working directory.
Filesystem · /home/cadet
cadet@cs210:~$
How this works: This is a practice terminal, not a real one. The task card above tells you what command to run next. The tree on the right highlights where you are; new directories and files appear as you create them. Type help any time to see the commands available.

Practice Terminal 2: Git Workflow

Nine tasks walking through the full daily Git cycle: clone, navigate, inspect, edit, stage, commit, push.

Before you begin

Enter your name. It will appear on the completion screen so you can include it in your screenshot for the Blackboard reflection quiz.

CS210 Lesson 1 · Git Workflow Practice

Practice the commands you will use every day in CS210. Follow each task. Type the command and press Enter.
Task 0 of 9
Current task
Loading...
cadet@cs210:~$
How this works: This is a practice terminal, not a real one. Free-form commands like ls and cd work for exploration. The task card above tells you what command to run next. Get it right and you move to the next task. Type help any time to see available commands.
6. After Class
  • Complete Lab 1 if you did not finish it in class.
  • Finish the In-Class CLI walkthrough or Git Workflow Practice widget if you ran out of class time. Both should be complete before Lesson 2.
  • Submit the Lesson 1 reflection on Blackboard if you did not submit it in class. You will need the completion codes from both widget screenshots.
  • If any setup step failed during the pre-class checklist, fix it before Lesson 2. Everything from here on assumes a working toolchain.
  • Read Beej-C Chapter 3 (Variables and Statements) before Lesson 2.
  • Heads-up: Quiz 1 is at Lesson 4 and covers Lessons 1 through 3 (toolchain and CLI from L1, variables and types from L2, operators and scanf from L3).
Optional ongoing CLI practice. The last two pages of Script DoggiesDwarf Mine Terminal and Typing Practice — are good places to keep your command-line reflexes sharp throughout the semester. Not required; come back when you want a quick drill.
Need help? Schedule EI with your instructor. Bring specific code or specific screenshots, and the exact error message or output you do not understand. Check the course Resources before scheduling if you want to try one more thing first. Specific questions get unstuck quickly.