DevOps for Developers — 01. Linux & Terminal

Mental Model: As a developer you don't need to be a Linux sysadmin. You need to be comfortable enough to: SSH into a server, read logs, debug a running process, manage files, and not accidentally break things. Every cloud server, Docker container, and CI runner is Linux.

Skill Core Concepts & Mental Model Key Commands & Techniques Tradeoffs & Failure Modes Resources
File System Navigation Linux file tree: everything is a file. / is root. Key dirs: /etc (system configs), /var/log (logs), /home (user dirs), /tmp (cleared on reboot), /usr/bin (installed binaries), /proc (live kernel/process info) ls -la, cd, pwd, find / -name "file" -type f, tree, du -sh * (disk usage per dir), df -h (disk free), stat file (metadata) rm -rf with wrong path = unrecoverable data loss. Always double-check path before destructive commands. /proc/meminfo and /proc/cpuinfo are useful for inspecting running system without installing tools Linux Command Line (free book)
File Operations & Permissions Linux permissions: owner / group / others × read(4) / write(2) / execute(1). Octal notation: 755 = rwxr-xr-x. Symbolic: chmod +x file cp, mv, rm -rf, mkdir -p (create nested dirs), touch, cat, less, head -n 20, tail -f (live log follow), grep -r "text" ., chmod 755 file, chown user:group file, ln -s target link (symlink) Never run chmod 777 — world-writable files are a security risk. chown -R as root on wrong directory can break system binaries. tail -f is the most-used command for watching live logs in production chmod Calculator
Process Management Every running program is a process with a PID. Parent-child relationships. Signals: SIGTERM (15) = graceful shutdown request, SIGKILL (9) = force kill (no cleanup), SIGHUP (1) = reload config ps aux (all processes), top / htop (live — htop is better), kill -15 PID (graceful), kill -9 PID (force), pkill node (by name), lsof -i :3000 (what's using port 3000), nohup command & (survive logout), jobs / fg / bg kill -9 skips cleanup handlers — use kill -15 first, wait 5s, then kill -9 if needed. Zombie processes = child exited but parent never collected exit status (ps shows Z state). lsof -i :3000 is the most useful command when "port already in use" DigitalOcean Process Guide
Text Processing Parse logs, extract data, transform output — the most frequent real-world Linux task. Pipe chains process data as streams — no memory issue for huge files grep -E "ERROR WARN" app.log (regex), grep -v "health" (exclude), awk '{print $1}' (print column), sed 's/old/new/g' (replace), sort uniq -c
Environment & Shell Shell (bash/zsh) interprets commands. Environment variables are key=value pairs inherited by child processes. PATH controls where shell searches for binaries export VAR=value (current session), echo $VAR, env (all vars), printenv VAR, which node (binary location), type command (alias vs binary), source ~/.zshrc (reload config). Add to ~/.zshrc or ~/.bashrc for persistence export in terminal = session only. Secrets in .bashrc/.zshrc = visible in plain text and potentially git-tracked. Use direnv (per-directory .envrc files) for project-specific env vars without polluting global shell direnv
SSH Encrypted remote terminal access. Key-based auth: your private key + server's authorized_keys. More secure and more convenient than passwords. Never enable password auth on production servers ssh-keygen -t ed25519 -C "email" (generate keypair), ssh-copy-id user@ip (add pubkey to server), ssh user@ip, ssh -i key.pem user@ip (AWS style), chmod 400 key.pem (required by SSH), ~/.ssh/config for saved host aliases, ssh -L 5432:localhost:5432 user@server (port forwarding — access remote DB locally) Private key must never leave your machine. PEM files require chmod 400 — SSH refuses overly-permissive keys. ed25519 is preferred over RSA (shorter key, same security). SSH port forwarding is the safest way to access remote DBs locally without exposing DB port publicly SSH Essentials
Cron Jobs Schedule recurring tasks. Runs as the crontab owner's user. Format: minute hour day month weekday command (5 fields) crontab -e (edit), crontab -l (list), 0 2 * * * /scripts/backup.sh (daily at 2am), */5 * * * * (every 5 min). Always redirect output: >> /var/log/cron.log 2>&1. Use absolute paths for binaries: /usr/bin/node not node Cron uses minimal PATH — relative binary names silently fail. Silent failures are the #1 cron bug — always log output. Test scripts manually before adding to crontab. For distributed systems use BullMQ repeatable jobs or Inngest instead of cron — avoids multi-instance double-execution Crontab Guru
Networking Commands Debug connectivity issues, inspect open ports, trace network paths curl -I https://api.example.com (HTTP headers), curl -v (verbose — full request/response), wget, ping, traceroute / tracepath, netstat -tulpn (open ports + listening processes), ss -tulpn (modern replacement for netstat), nc -zv host port (test port connectivity), dig domain (DNS lookup), nslookup domain curl -v is the most useful tool for debugging API calls from a server. ss -tulpn shows exactly what's listening on which port. If curl works but browser doesn't = DNS or CORS issue, not a server issue —
System Monitoring Understand resource usage before scaling or debugging performance issues htop (interactive process + CPU/memory), free -h (memory), df -h (disk), iostat (disk I/O), vmstat (CPU/memory/IO overview), uptime (load averages), dmesg (kernel messages — hardware/boot issues), journalctl -u myservice -f (systemd service logs, live) Load average > number of CPU cores = CPU bottleneck. Memory usage near 100% + swap increasing = memory leak. Disk full = silent failures (logs stop writing, DB crashes). Check df -h before diagnosing mysterious errors —
Package Management Install, update, remove system packages. apt (Debian/Ubuntu), yum/dnf (RHEL/Amazon Linux) apt update (refresh package index), apt install -y package, apt remove package, apt list --installed, which binary (confirm install). On Alpine (Docker): apk add --no-cache package Always apt update before apt install in Docker or CI — stale package index = version not found errors. Use apt-get (non-interactive) in Dockerfiles, not apt (interactive). Pin package versions in Dockerfiles for reproducible builds —

DevOps for Developers — 02. Git & Version Control

Mental Model: Git tracks snapshots of your project, not diffs. Three areas: Working Directory (files you edit) → Staging Area (what you mark for commit) → Repository (committed history). Commits are immutable content-addressed objects — you never modify history, you add new commits on top.

Skill Core Concepts & Mental Model Key Commands & Techniques Tradeoffs & Failure Modes Resources
Core Concepts Four Git objects: Blob (file content), Tree (directory), Commit (snapshot + metadata + parent), Tag (named commit). HEAD = pointer to current commit. Branch = lightweight pointer that moves forward on each commit git add ., git commit -m "message", git status, git log --oneline --graph --all, git diff (unstaged), git diff --staged (staged), git show <hash> (inspect commit) Committing node_modules or .env = bloated repo + leaked secrets. Always have .gitignore before first commit. Large binary files in git history are permanent — use Git LFS for assets Pro Git Book (free)
Branching & Merging Branches are cheap pointers to commits. Three strategies: GitHub Flow (main + feature branches — best for most teams + CI/CD), GitFlow (main/develop/feature/hotfix — complex, slower), Trunk-Based Development (everyone commits to main daily with feature flags — fastest, requires discipline) git checkout -b feature/name, git merge feature/name (merge commit), git rebase main (linear history), git cherry-pick <hash> (single commit), git branch -d feature/name, git branch -a (all branches including remote) Long-lived feature branches = merge conflict pain. Rebase rewrites history — never rebase shared/pushed branches. Cherry-pick overused = diverged history. Trunk-based development requires feature flags to hide incomplete work —
Remote Workflows origin = your primary remote (GitHub/GitLab). upstream = original repo (open source forks). fetch downloads without merging. pull = fetch + merge git remote -v, git fetch origin (download, no merge), git pull origin main, git push origin feature/name, git push --force-with-lease (safer than -f — fails if remote has new commits), git clone --depth 1 url (shallow clone — faster for CI) git pull on wrong branch = merges into wrong branch. git push -f on shared branches overwrites teammates' commits. Always use --force-with-lease instead of --force. Shallow clones miss full history — some git operations fail —
Undoing Changes Git almost never permanently deletes committed data (reflog retains for 90 days). Strategy depends on whether commits are local or already pushed to shared branch git restore file (discard working dir changes), git reset HEAD~1 (undo last commit, keep changes staged), git reset --hard HEAD~1 (undo + discard — dangerous), git revert <hash> (safe undo for pushed commits — creates new reverting commit), git stash / git stash pop, git reflog (find lost commits) git reset --hard = local changes gone. Check reflog before panicking. git revert is the ONLY safe undo for already-pushed commits — never reset shared history. git stash drop = stash gone permanently —
Conventional Commits Structured commit message format that enables: automated changelogs, semantic versioning, readable history, and CI triggers based on commit type Types: feat (new feature → minor version bump), fix (bug fix → patch bump), chore (maintenance), refactor, docs, test, ci, perf, BREAKING CHANGE (→ major bump). Format: type(scope): description. Example: feat(auth): add OAuth Google login Inconsistent commit messages = useless git log. WIP commits should be squashed before merge (git rebase -i). Use commitlint + husky to enforce format in CI Conventional Commits
Branch Protection & GitHub Workflows Pull Requests are the unit of code review and the CI trigger. Branch protection enforces quality gates before merge. CODEOWNERS auto-assigns reviewers by file path Branch protection rules: require PR review before merge, require CI status checks to pass, disable force push to main, require linear history. CODEOWNERS: src/auth/ @security-team. Merge strategies: Squash merge (clean history), Rebase merge (linear), Merge commit (full history) Direct push to main = no review, no audit trail. Missing status check requirement = broken CI doesn't block merge. Squash merge loses individual commit history — use for feature branches. Merge commit for releases (preserves full context) GitHub Branch Protection
Secrets & .gitignore .gitignore prevents files from being tracked. But once a file is committed, removing from .gitignore doesn't remove from history .gitignore essentials: node_modules/, .env, .env.local, dist/, .DS_Store, *.log, coverage/. Remove accidentally committed file: git rm --cached .env → commit. If secret already pushed: rotate immediately, use git-filter-repo to purge history, assume it's compromised .gitignore must exist before first commit — files already tracked are not ignored by adding them later. git rm --cached removes from tracking but keeps local file. Private repo does NOT mean secrets are safe — treat all committed secrets as compromised gitignore templates
Git Hooks & Automation Scripts that run automatically at Git lifecycle events. Pre-commit: run linting/formatting before commit. Commit-msg: validate commit message format. Pre-push: run tests before push husky (manage hooks in package.json), lint-staged (run linters only on staged files — fast). Setup: npx husky init → .husky/pre-commit → npx lint-staged. package.json: "lint-staged": { "*.ts": ["eslint --fix", "prettier --write"] } Hooks run locally — can be bypassed with git commit --no-verify. Never put critical security checks only in hooks — enforce in CI too. Slow hooks = developers bypass them husky docs
Monorepo Git Patterns Single repo for multiple apps/packages. Git operations need to be scoped — you don't want to run all tests when only one package changed Turborepo: turbo run test --filter=@myapp/api (run only affected). GitHub Actions path filters: on.push.paths: ['apps/api/**'] to trigger only relevant workflows. git diff --name-only HEAD~1 to detect changed packages Without path-based CI filtering: every commit triggers full test suite for all packages = slow. Turborepo remote cache: reuse unchanged package build outputs across CI runs Turborepo
Git in 2026 — AI-assisted Workflows Git workflows now integrate with AI tools for: auto-generated commit messages, PR descriptions, code review suggestions, and conflict resolution assistance GitHub Copilot generates commit messages and PR descriptions. git commit with Copilot CLI. Cursor/Windsurf AI-assisted merge conflict resolution. Conventional commit message generation from staged diff AI-generated commit messages can be generic — review before accepting. AI PR descriptions miss business context — always add "why" manually. Auto-merge bots (Renovate, Dependabot) handle dependency updates via PRs GitHub Copilot CLI

DevOps for Developers — 03. CI/CD Pipelines

Mental Model: CI/CD makes deployment a non-event — small, frequent, automated, and reversible. CI (Continuous Integration) catches bugs early by building and testing every commit. CD (Continuous Delivery/Deployment) removes manual steps from shipping code. The goal: confidence to deploy 10 times a day without fear.