Duration: 2 hours (≈ 10 min per command). Audience: Developers who need to master the basic tooling used on a Linux workstation or build server.
git – Version Controlgit init myrepo cd myrepo echo "Hello, Git!" > hello.txt git add hello.txt git commit -m "Initial commit" git remote add origin https://github.com/you/myrepo.git git push -u origin master
git clone https://github.com/git/git.git.bash – Script Automation#!/usr/bin/env bash # backup.sh – simple backup of a directory SRC="/home/you/project" DEST="/tmp/project-backup-$(date +%F).tar.gz" tar -czf "$DEST" "$SRC" echo "Backup created at $DEST"
chmod +x backup.sh.python & pip – Package Managementpython3 -m venv venv
source venv/bin/activate
pip install requests
python -c "import requests, sys; print(requests.get('https://api.github.com').status_code)"
requirements.txt with flask and jinja2 and install it with pip install -r requirements.txt.pip freeze > pinned.txt.node & npm – JavaScript Runtimenpm init -y
npm install express
node -e "const express=require('express');const app=express();app.get('/',(req,res)=>res.send('Hello!'));app.listen(3000,()=>console.log('Listening 3000'))"
app.js that serves static files from a public directory.http://localhost:3000 from a browser.gcc & make – C Build Tools# hello.c
#include <stdio.h>
int main(){ printf("Hello from C!\n"); return 0; }
# Makefile
CC=gcc
CFLAGS=-Wall -O2
TARGET=hello
all: $(TARGET)
$(TARGET): hello.c
$(CC) $(CFLAGS) -o $(TARGET) hello.c
clean:
rm -f $(TARGET)
make to build the binary../hello and capture its output.cmake – Modern Build System# CMakeLists.txt cmake_minimum_required(VERSION 3.10) project(Hello C) add_executable(hello hello.c)
mkdir build && cd build.cmake .. && make../hello and verify the output.sed – Stream Editor# Replace "foo" with "bar" in file.txt sed -i 's/foo/bar/g' file.txt # Show only lines containing "error" sed -n '/error/p' logfile.txt
foo and run the replacement command.sed to delete the 3rd line of a file.awk – Pattern Scanning# Sum the 3rd column in a CSV
awk -F',' '{sum+=$3} END{print sum}' data.csv
# Print the 1st and 3rd fields of lines that contain "PASS"
awk '$0 ~ /PASS/ {print $1, $3}' results.txt
passwd where the UID is greater than 1000.vim – Powerful Text Editor# Basic vim workflow vim file.txt # enter normal mode i # insert mode ...edit... Esc # back to normal :wq # write & quit # Example of searching /keyword n # next match
/etc/passwd in vim and navigate to the line containing root.root with admin (just in the buffer, don’t write yet).tmux – Terminal Multiplexer# Start a new session tmux new -s dev # Split horizontally Ctrl+b % # Split vertically Ctrl+b " # Switch panes Ctrl+b o # Detach Ctrl+b d # List sessions tmux ls # Attach to session tmux attach -t dev
top in one and watch -n1 date in the other.grep – Pattern Matching# Find all files containing "TODO" grep -rl "TODO" . # Show only the matching part grep -o "error:.*" syslog.log # Recursive search case‑insensitive grep -ri "fatal" .
def main.makefile.find – File Discovery# Find all .log files modified in last 7 days
find . -name "*.log" -mtime -7
# Delete all .tmp files
find /tmp -type f -name "*.tmp" -delete
# Execute a command on each file
find . -name "*.py" -exec pyflakes {} +
*.bak files by removing the extension.curl – HTTP Client# GET request
curl https://api.github.com/repos/torvalds/linux
# POST with JSON payload
curl -X POST https://httpbin.org/post \
-H "Content-Type: application/json" \
-d '{"name":"dev","role":"engineer"}'
curl command.curl -L -o to follow redirects.jq – JSON Processor# Extract all tag names from GitHub releases curl https://api.github.com/repos/nodejs/node/releases \ | jq '.[].tag_name' # Pretty‑print and filter cat data.json | jq '.[] | select(.active==true) | .name'
config.json, extract the value of database.host.enabled set to true.Students will combine at least 5 of the commands above to build a tiny static site generator that:
site directory.template.html into site/index.html.posts/, converts them to HTML using pandoc (installed via apt or brew).sed to replace a placeholder (e.g., {{content}}) with the rendered HTML.build.sh script that orchestrates all steps and can be run with ./build.sh.git commit and pushes the final site/ to a GitHub Pages repo.Deliverables: build.sh, README.md explaining the pipeline, and a live site served via python3 -m http.server.
git, grep, and awk to produce a report of all TODO comments in the repo.Score sheet (out of 30 points):
| Task | Points |
|---|---|
| Git clone/commit/push | 5 |
| Bash script (backup.sh) | 5 |
| Python pip env | 5 |
| gcc/make build | 5 |
| sed/awk usage | 5 |
| Mini‑project | 5 |