Software engineering blog · quick reference
SWE Cheatsheet ▋
Terminal commands for navigation, debugging, scripting, SSH, Python CLI, Git, and Docker in one practical sheet.
Published June 2026 · 6 min read · Hands-on workflow
$ command you type
output
# comment
error
01 Navigation where am I?
| pwd | Print working dir — "where am I?" |
| ls -laF | List: long, hidden, mark dirs with / |
| cd dir | Move into a folder |
| cd .. | Up one level (parent) |
| cd ~ | Jump home from anywhere |
| cd - | Bounce to previous folder |
| mkdir d | Make a folder |
| touch f | Make an empty file |
.HERE
..PARENT
~HOME
/ROOT
02 Reading errors debug
command not found
Typo or not installed. Fix: check spelling / install it
No such file or directory
Wrong folder. Fix: pwd, ls, fix the path
Permission denied
Not executable. Fix: ls -l, then chmod +x
THE LOOP
Read→
Reproduce→
Isolate→
1 change→
Verify
03 Processes what's running?
| ps aux | Snapshot — all processes now (PID, %CPU, %MEM) |
| top | Live view — auto-refreshing |
| htop | Friendlier live view (color, scroll) |
| kill PID | Stop politely (SIGTERM) |
| kill -9 PID | Force kill — last resort |
Inside top:
P cpu ·
M memory ·
q quit
04 Shell scripting automate
#!/bin/bash
# comment
name="Asha" # no spaces around =
echo "Hi, $name!"
echo "Arg 1: $1"
| chmod +x s.sh | 1. Make it executable |
| ./s.sh | 2. Run it |
| $1 $2 $@ | Arguments (one, two, all) |
| > >> | Redirect output (overwrite, append) |
05 SSH remote machines
ssh user@hostname
ssh -p 2222 user@host
ssh-keygen -t ed25519
ssh user@host "ls -la"
exit # come home
Private key stays on your laptop; public key goes on the server. First connect → type yes to the fingerprint. After connecting, every command runs on the remote machine.
06 Python via CLI run code
| python3 | REPL — >>> prompt; exit() or Ctrl-D |
| python3 app.py | Script — how real programs run |
| python3 -c "…" | One-liner inline |
| python3 -m http.server | Run a module as a program |
| sys.argv[1] | First command-line argument |
⚠ Windows: native uses python / py; macOS / Linux / WSL use python3.
07 Git basics save history
| git init | Start a repo |
| git status | What changed (your truth-teller) |
| git add . | Stage changes |
| git commit -m "…" | Save a snapshot |
| git log --oneline | View history, compact |
Flow: working dir → add → staging → commit → repo.
Always add before commit.
08 Git branching parallel work
git switch -c feature-x # new branch
# …edit · add · commit…
git switch main
git merge feature-x
git branch # list all
git log --oneline --graph --all
Never build on main directly. One branch per feature → merge when it works = the GitHub PR workflow.
Old Git: checkout -b = switch -c.
09 Docker run anywhere
| docker run hello-world | Verify install |
| docker run -it img cmd | Run interactively |
| docker ps -a | List containers (all) |
| docker images | List local images |
| docker build -t app . | Build image from Dockerfile |
| docker run app | Run your image |
Image = recipe · Container = running instance.
"Cannot connect to daemon" → start Docker Desktop.
WindowsUse Git Bash or WSL (Ubuntu). Avoid plain CMD/PowerShell. C: drive = /mnt/c/ in WSL.
macOSBuilt-in Terminal, default shell zsh. Every command here works.
LinuxBuilt-in Terminal (bash). For Docker: sudo usermod -aG docker $USER, then re-login.