Home/Developer Cheat Sheets
Interactive Engineering References • 1-Click Copy

Developer & Tech Command Cheat Sheets

Quickly search and copy high-utility commands for Linux server administration, Git version control, Docker container operations, and SQL database pipelines.

Permissions

Chmod 755 (Read/Execute for all, Write for Owner)

Sets rwxr-xr-x permissions. Standard for executable web scripts and directories.

chmod 755 filename.sh
Disk & Files

Find Files Larger Than 100MB

Searches root partition for giant files eating up storage.

find / -type f -size +100M -exec ls -lh {} \;
Archiving

Create Gzip Compressed Tarball

-c (create), -z (gzip), -v (verbose), -f (filename). Archives directory.

tar -czvf backup-archive.tar.gz /var/www/html
Networking

Kill Process Running on Specific Port

Instantly frees locked port 3000 or 8080.

fuser -k 3000/tcp || npx kill-port 3000
Processes

Inspect Live Server Resource Usage

Interactive real-time process monitoring sorted by CPU usage.

htop || top -o %CPU
Rebasing

Interactive Rebase Last N Commits

Squash, edit, or reorder the last 3 local commits before pushing to remote.

git rebase -i HEAD~3
Undo

Undo Last Commit but Keep Staged Changes

Moves HEAD back 1 commit without touching your modified files in working directory.

git reset --soft HEAD~1
Stash

Stash Changes with Custom Descriptive Message

Shelves dirty working tree state with a searchable tag.

git stash push -m 'WIP: auth integration refactor'
Branching

Cherry-Pick Specific Commit to Current Branch

Applies the exact diff of a commit from another branch to current HEAD.

git cherry-pick a1b2c3d4
Branching

Force Delete Local and Remote Branch

Prunes abandoned or merged feature branch everywhere.

git branch -D feature/login && git push origin --delete feature/login
Run

Run Background Container with Port Forwarding

Runs nginx container detached in background mapped to host port 8080.

docker run -d -p 8080:80 --name my-web-app nginx:alpine
Cleanup

Clean All Unused Containers, Networks & Images

Reclaims tens of gigabytes of disk space by pruning dangling cache and unused layers.

docker system prune -a --volumes -f
Diagnostics

Tail Container Live Output Logs

Streams recent 100 stdout lines in real-time.

docker logs -f --tail 100 <container-id>
Terminal

Execute Interactive Bash Shell Inside Container

Opens terminal prompt inside running Alpine or Debian container.

docker exec -it <container-id> /bin/sh
Success

200 OK vs 201 Created

Use 201 when a POST or PUT creates a new persistent resource.

HTTP/1.1 201 Created
Location: /api/v1/orders/108
Redirects

301 Moved Permanently vs 302 Found

301 passes 99% SEO link equity (PageRank). 302 is temporary and doesn't update indexing.

HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-url
Auth

401 Unauthorized vs 403 Forbidden

401 is authentication (identity unknown). 403 is authorization (identity known, but no access).

HTTP/1.1 401 Unauthorized (Missing/Expired JWT)
HTTP/1.1 403 Forbidden (Valid JWT, but not Admin)
Server Errors

502 Bad Gateway vs 504 Gateway Timeout

Critical difference when debugging microservices behind Cloudflare or AWS ALB.

502: Reverse proxy (Nginx) got invalid response from upstream (Node/Python).
504: Upstream did not respond before proxy timeout.
Window Functions

Rank Items by Revenue (Window Function)

Calculates intra-department salary rank without collapsing rows with GROUP BY.

SELECT employee_id, department, salary, DENSE_RANK() OVER (PARTITION BY department ORDER BY salary DESC) as rank FROM employees;
Aggregation

Find Duplicate Emails in Users Table

Filters aggregate groups using HAVING to detect duplicate account records.

SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1;
CTE

Common Table Expression (CTE) For Clean Pipelines

Readable modular subqueries replacing messy nested joins.

WITH active_subs AS (
  SELECT user_id, plan_id, created_at FROM subscriptions WHERE status = 'active'
)
SELECT u.email, s.plan_id FROM users u JOIN active_subs s ON u.id = s.user_id;