Skip to content

Cheatsheet

3 frequency levels:

  • daily — you type these every day, learn them by heart. If you know these, you’ll be fine.
  • occasional — useful regularly, you’ll come back here to look them up when needed.
  • rarely — you’ll need these once or twice, mostly for setup or cleanup.

Words between <angle brackets> are placeholders — replace them with your own value. Example: git checkout -b <branch>git checkout -b feature/login

CommandDescriptionFrequency
git statusSee the current statedaily
git add .Stage everythingdaily
git commit -m "<message>"Commitdaily
git pushPush to the remotedaily
git pullPull from the remotedaily
git checkout -b <branch>Create and switch to a branchdaily
git log --onelineCompact historyoccasional
git merge <branch>Merge a branchoccasional
git initInitialize a reporarely
git branch <branch>Create a branch (without switching to it)rarely
CommandDescriptionFrequency
ls -laList everything (including hidden files)daily
cd <path>Move to a directorydaily
cat <file>Read a filedaily
mkdir -p <path>Create directories recursivelydaily
grep -r "<text>" <directory>/Search for textdaily
sudo apt update && sudo apt install -y <package>Install a package (e.g. curl, git)daily
pwdShow current directoryoccasional
nano <file>Edit a file in the terminaloccasional
rm -r <directory>Delete (recursive)occasional
cp -r <source> <destination>Copy (recursive)occasional
mv <source> <destination>Move / renameoccasional
chmod 755 <file>Change permissionsoccasional
export <VAR_NAME>="<value>"Set an environment variableoccasional
ps auxList processesoccasional
kill <PID>Kill a process (PID = number shown by ps aux)occasional
find . -name "*.py"Search for filesrarely
chown <user>:<group> <file>Change the ownerrarely
systemctl start/stop/status <service>Manage a service (e.g. nginx, docker)rarely
whoamiShow current userrarely
printenvList environment variablesrarely
journalctl -u <service>View logs for a servicerarely
CommandDescriptionFrequency
curl <URL>HTTP request (e.g. curl http://localhost:8000/api/tasks)daily
ss -tlnpOpen portsoccasional
ping <host>Test connectivity (e.g. ping google.com)occasional
curl -I <URL>View headersoccasional
dig +short <domain>Resolve a DNS (e.g. dig +short google.com)rarely
wget <URL>Download a filerarely
hostname -IView your private IPrarely
curl ifconfig.meView your public IPrarely
traceroute <host>Network pathrarely
sudo ufw allow <port>Open a port (e.g. sudo ufw allow 8000)rarely
sudo ufw enableEnable the firewallrarely
sudo ufw statusView the rulesrarely
MethodWhat it doesExample
GETRead a resourcecurl http://localhost:8000/api/tasks
POSTCreate a resourcecurl -X POST -H "Content-Type: application/json" -d '{"title":"..."}' http://localhost:8000/api/tasks
PATCHUpdate an existing resourcecurl -X PATCH http://localhost:8000/api/tasks/1
PUTUpdate an existing resource(not used in this project)
DELETEDeletecurl -X DELETE http://localhost:8000/api/tasks/1

PATCH vs PUT: to keep it simple, both are used to update data that already exists. The technical difference: PATCH only modifies the fields you send, PUT replaces the entire resource. In practice, many APIs use one or the other interchangeably. In this course we use PATCH — if you see PUT elsewhere, just think of it as the same idea.

CommandDescriptionFrequency
docker compose up -d --buildStart with Composedaily
docker compose downStop everythingdaily
docker compose psView service statusdaily
docker compose logs -fLogs for all servicesdaily
docker psRunning containersdaily
docker logs -f <container>Follow a container’s logsdaily
docker exec -it <container> bashEnter a containeroccasional
docker build -t <name>:<tag> .Build an image (e.g. docker build -t my-app:1.0 .)occasional
docker stop <container>Stop a containeroccasional
docker rm <container>Remove the containeroccasional
docker ps -aAll containers (including stopped ones)occasional
docker run -d -p <host_port>:<container_port> --name <name> <image>Run a container without Composerarely
docker rmi <image>Remove the imagerarely
docker pull <image>Download an image (e.g. docker pull postgres:16)rarely
docker imagesList local imagesrarely
docker system dfView disk space used by Dockerrarely
docker system prune -aClean up unused images/containersrarely
CommandDescriptionFrequency
bun installInstall dependenciesdaily
bun run devStart the dev serverdaily
bun run buildBuild for productionoccasional
bunx oxlint .Run the linteroccasional

Bun replaces npm + Node.js. The equivalent npm commands: npm install, npm run dev, npx oxlint .

CommandDescriptionFrequency
uv syncInstall dependenciesdaily
uv run uvicorn main:app --reloadStart the backend serverdaily
uv run pytestRun the testsdaily
uv run ruff check .Run the linteroccasional
uv add <package>Add a dependency (e.g. uv add fastapi)rarely

uv replaces pip + venv. The equivalent commands: pip install -r requirements.txt, python -m pytest

# Minimal structure
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Hello CI"
ConceptSyntax
Secret${{ secrets.<SECRET_NAME> }}
Dependency between jobsneeds: <job_name>
Conditionif: github.ref == 'refs/heads/main'
CommandDescriptionFrequency
aws ec2 describe-instancesList instancesdaily
aws ec2 stop-instances --instance-ids <ID>Stop (e.g. --instance-ids i-0abc123)daily
aws ec2 start-instances --instance-ids <ID>Startdaily
aws s3 cp <file> s3://<bucket>/Uploadoccasional
aws s3 ls s3://<bucket>/List bucket contentsoccasional
aws ec2 terminate-instances --instance-ids <ID>Permanently deleteoccasional
aws configureConfigure credentialsrarely
aws s3 mb s3://<bucket>Create a bucketrarely
aws rds describe-db-instancesList RDS databasesrarely
aws rds delete-db-instance --db-instance-identifier <ID> --skip-final-snapshotDelete an RDS databaserarely
aws lambda list-functionsList Lambda functionsrarely
aws lambda invoke --function-name <NAME> output.jsonInvoke a Lambdararely
aws lambda delete-function --function-name <NAME>Delete a Lambdararely
CommandDescriptionFrequency
terraform planPreviewdaily
terraform applyApplydaily
terraform initInitialize (download providers)occasional
terraform destroyDelete everythingoccasional
terraform fmtFormat the codeoccasional
terraform validateCheck the syntaxrarely
terraform state listView managed resourcesrarely
CommandDescriptionFrequency
ansible-playbook -i <inventory> <playbook>.ymlRun a playbookdaily
ansible -i <inventory> <hosts> -m pingTest the connectionoccasional
ansible-playbook -i <inventory> <playbook>.yml --checkDry runoccasional
ansible-vault encrypt <file>Encrypt a filerarely
CommandDescriptionFrequency
kubectl get podsList podsdaily
kubectl get servicesList servicesdaily
kubectl logs <pod>View logsdaily
kubectl apply -f <file>.ymlApply a configdaily
kubectl describe pod <pod>Pod detailsoccasional
kubectl get deploymentsList deploymentsoccasional
kubectl delete -f <file>.ymlDeleteoccasional
kubectl scale deployment <name> --replicas=<N>Scale (e.g. --replicas=3)occasional
kubectl rollout status deployment/<name>Track a deploymentrarely
kubectl get namespacesList namespacesrarely
kubectl set image deployment/<name> <container>=<image>:<tag>Update the imagerarely
minikube startStart the local clusterrarely
minikube stopStop the local clusterrarely
minikube image load <image>Load a local image into minikuberarely
minikube service <name> --urlGet a service’s URLrarely
Command / URLDescriptionFrequency
http://localhost:9090Prometheus UIdaily
http://localhost:3001Grafana UIdaily
curl http://localhost:8000/metricsView raw metricsoccasional
rate(<metric>[1m])Rate per second (PromQL)rarely
histogram_quantile(0.95, ...)95th percentile (PromQL)rarely
docker compose up -d (with prometheus.yml)Start Prometheus + Grafanararely