CLI Cheatsheet
Searchable cheatsheet for git/docker/kubectl/curl/find common commands
34 commands
git
Show last 10 commits as one-line summariesgit log --oneline -10git
Compact summary of changed filesgit diff --statgit
Save uncommitted changes with a labelgit stash push -m 'wip'git
Create and switch to new branchgit checkout -b feature/foogit
Force-push safely (fails if remote moved)git push origin HEAD --force-with-leasegit
Interactive rebase last 5 commitsgit rebase -i HEAD~5git
Visual branch graphgit log --all --graph --onelinegit
Show all HEAD movements (recovery from accidents)git refloggit
Who changed lines 10-20 in file.tsgit blame file.ts -L 10,20git
Binary search for the commit that introduced a buggit bisect start && git bisect bad && git bisect good <sha>docker
List all containers in tabular formatdocker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Status}}'docker
Open a shell inside a running containerdocker exec -it <container> shdocker
Follow container logs (tail -f)docker logs -f <container>docker
Remove all unused images, containers, networks, and volumesdocker system prune -a --volumesdocker
Rebuild images and start services in detached modedocker compose up -d --builddocker
One-shot container resource usagedocker stats --no-streamdocker
Container state with jqdocker inspect <container> | jq '.[].State'kubectl
Watch pod status in a namespacekubectl get pods -n <namespace> -wkubectl
Follow logs from a specific containerkubectl logs -f <pod> -c <container>kubectl
Open a shell in a podkubectl exec -it <pod> -- /bin/shkubectl
Detailed pod info (events, conditions)kubectl describe pod <pod>kubectl
Preview changes without applyingkubectl apply -f manifest.yaml --dry-run=client -o yamlkubectl
Watch deployment rolloutkubectl rollout status deployment/<name>kubectl
Rollback to previous deploymentkubectl rollout undo deployment/<name>curl
GET with response headers showncurl -i https://api.example.comcurl
POST JSON bodycurl -X POST -H 'Content-Type: application/json' -d '{"k":"v"}' https://api.example.comcurl
Follow redirects, save to filecurl -L https://x.com -o output.htmlcurl
Measure total time, discard bodycurl -w '\ntime_total: %{time_total}s\n' -o /dev/null -s https://x.comcurl
HTTP basic authcurl -u user:pass https://x.comfind
All .ts files excluding node_modulesfind . -name '*.ts' -not -path '*/node_modules/*'find
Files larger than 100 MBfind . -size +100M -type ffind
Files modified in the last 7 daysfind . -mtime -7 -type ffind
Delete all .log files (be careful!)find . -name '*.log' -deletefind
All .py files containing 'TODO'find . -type f -name '*.py' -exec grep -l 'TODO' {} +Verify outputs before using in production. No warranty โ see Terms.