PathtoAI Academy · SWE Blog
Home Back to Blogs
Software engineering blog · quick reference

SWE Cheatsheet

Terminal commands for navigation, debugging, scripting, SSH, Python CLI, Git, and Docker in one practical sheet.

$ command you type output # comment error

01 Navigation where am I?

pwdPrint working dir — "where am I?"
ls -laFList: long, hidden, mark dirs with /
cd dirMove into a folder
cd ..Up one level (parent)
cd ~Jump home from anywhere
cd -Bounce to previous folder
mkdir dMake a folder
touch fMake 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 auxSnapshot — all processes now (PID, %CPU, %MEM)
topLive view — auto-refreshing
htopFriendlier live view (color, scroll)
kill PIDStop politely (SIGTERM)
kill -9 PIDForce 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.sh1. Make it executable
./s.sh2. 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

python3REPL — >>> prompt; exit() or Ctrl-D
python3 app.pyScript — how real programs run
python3 -c "…"One-liner inline
python3 -m http.serverRun 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 initStart a repo
git statusWhat changed (your truth-teller)
git add .Stage changes
git commit -m "…"Save a snapshot
git log --onelineView history, compact
Flow: working diraddstagingcommitrepo. 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-worldVerify install
docker run -it img cmdRun interactively
docker ps -aList containers (all)
docker imagesList local images
docker build -t app .Build image from Dockerfile
docker run appRun your image
Image = recipe · Container = running instance. "Cannot connect to daemon" → start Docker Desktop.
Windows

Use Git Bash or WSL (Ubuntu). Avoid plain CMD/PowerShell. C: drive = /mnt/c/ in WSL.

macOS

Built-in Terminal, default shell zsh. Every command here works.

Linux

Built-in Terminal (bash). For Docker: sudo usermod -aG docker $USER, then re-login.