Stage 2 · Tools
Shell Scripting & Automation
Bash, Zsh, and POSIX shell from first script to production-grade automation — the scripting skill every SRE relies on every day.
Prerequisite
Comfort on the command line.
What this course leaves you with
- Write production Bash with proper error handling
- Parse logs, manage processes, and automate daily work
- Turn runbooks into repeatable scripts
Why this stage matters — You can automate locally — now build services that run in production.
Progress
0 of 36 lessons complete. Progress is stored locally in your browser so you can pick the path back up later.
course completion
Bash Fundamentals
Variables, control flow, functions, and the mental model behind the Unix shell.
- 01Shell BasicsHow the shell parses commands, quoting rules, word splitting, and globbing.6 min
- 02Variables & ExpansionsVariables, parameter expansion, arithmetic, command substitution, and arrays.7 min
- 03Control Flowif/elif/else, for, while, until, case — with proper exit codes.7 min
- 04FunctionsDeclare functions, pass arguments, return values, and scope variables.6 min
- 05Script Structure & Shebang#!/usr/bin/env bash, set -euo pipefail, error handling, and script headers.6 min
- 06Debugging Scriptsset -x, set -v, shellcheck, and trap for script-level debugging.7 min
Text Processing
grep, awk, sed, cut, sort, uniq — the Unix text-processing toolkit for parsing logs and data.
- 01grep & ripgrepBasic and extended regex, context lines, recursive search, and ripgrep.7 min
- 02sed — Stream EditingSubstitute, delete, insert, and transform text streams in place.7 min
- 03awk — Data ProcessingField splitting, patterns, actions, and built-in variables for reporting.8 min
- 04cut, sort, uniq, trExtract columns, sort output, count occurrences, and translate characters.6 min
- 05jq — JSON ProcessingParse, filter, transform, and generate JSON from the command line.7 min
- 06Log Analysis in PracticeParse Nginx/Apache access logs, extract metrics, and summarize errors.8 min
Process & System Management
Start, stop, monitor, and manage processes — the operational scripting every SRE writes.
- 01Process Managementps, kill, pkill, pgrep, nice, nohup, and job control with & and fg/bg.7 min
- 02Signals & TrapsSIGTERM, SIGKILL, SIGHUP — handle signals gracefully in scripts with trap.7 min
- 03cron & systemd TimersSchedule jobs with cron syntax and modern systemd timer units.7 min
- 04File System Operationsfind, xargs, rsync, tar, and safe file manipulation patterns.7 min
- 05Disk & Memory Monitoringdf, du, free, vmstat — scripting resource monitoring and alerts.6 min
- 06Writing systemd ServicesCreate unit files, manage dependencies, and write clean ExecStart scripts.7 min
Network Scripting
curl, wget, nc, ssh — automate every network task from HTTP to SSH tunneling.
- 01curl — HTTP AutomationGET/POST/PUT/DELETE, headers, auth, follow redirects, and JSON payloads.7 min
- 02SSH Automationssh-keygen, ssh-copy-id, scp, rsync over SSH, and multiplexing.7 min
- 03nc, nmap & Port ScanningTest connectivity, scan ports, and debug network services.6 min
- 04Webhook Handler ScriptsReceive and respond to GitHub/Alertmanager webhooks with plain Bash.7 min
- 05Health Check ScriptsPoll endpoints, check DNS, test TLS certificates, and alert on failure.7 min
- 06Practice: On-Call RunbookConvert a common production runbook into an automated Bash script.8 min
Scripting Patterns
Idiomatic Bash patterns — argument parsing, error handling, logging, and portable scripts.
- 01Argument Parsinggetopts, usage functions, required vs optional flags, and input validation.7 min
- 02Error Handling Patternsset -e traps, pipefail, errexit, and building resilient scripts.7 min
- 03Logging in Shell ScriptsLog levels, timestamps, colored output, and writing to syslog.6 min
- 04Idempotent ScriptsWrite scripts that are safe to run multiple times without side effects.7 min
- 05Testing Shell Scriptsbats-core: test cases, assertions, setup/teardown for shell scripts.7 min
- 06Portable Scripting (POSIX)Write scripts that run on bash, dash, zsh, and busybox sh.6 min
DevOps Scripts in Practice
Real-world automation: deployment scripts, backup jobs, monitoring scripts, and CI helpers.
- 01Deployment ScriptsZero-downtime deploy, health checks, rollback, and notification on failure.8 min
- 02Backup AutomationDatabase dumps, file archives, S3 upload, and retention policy scripts.7 min
- 03CI Helper ScriptsVersion bumping, changelog generation, Docker build and push automation.7 min
- 04Secret Management in ScriptsAvoid hardcoded secrets — use Vault, env vars, and masked variables safely.7 min
- 05Kubernetes Automation Scriptskubectl loops, waiting for rollouts, and exporting cluster state.7 min
- 06Capstone: Production RunbookBuild a complete automated runbook for a production incident scenario.9 min