Clone a repository
Git
git clone <repo-url>Shallow clone (depth 1)
Git
git clone --depth 1 <repo-url>Clone specific branch
Git
git clone -b <branch> <repo-url>Initialize a repo
Git
git initCheck status
Git
git statusShort status
Git
git status -sStage all changes
Git
git add .Stage specific file
Git
git add <file>Stage interactively
Git
git add -pCommit with message
Git
git commit -m "message"Amend last commit
Git
git commit --amend -m "new message"Amend without editing msg
Git
git commit --amend --no-editCommit all tracked changes
Git
git commit -am "message"Empty commit
Git
git commit --allow-empty -m "trigger CI"Push to remote
Git
git push origin <branch>Force push
Git
git push --force-with-leasePush and set upstream
Git
git push -u origin <branch>Push all branches
Git
git push --allPull latest changes
Git
git pullPull with rebase
Git
git pull --rebasePull specific branch
Git
git pull origin <branch>Fetch all remotes
Git
git fetch --allFetch and prune
Git
git fetch --pruneCreate a new branch
Git
git checkout -b <branch>Switch branch
Git
git checkout <branch>Switch branch (new syntax)
Git
git switch <branch>Create & switch (new syntax)
Git
git switch -c <branch>List all branches
Git
git branch -aList merged branches
Git
git branch --mergedDelete a branch
Git
git branch -d <branch>Force delete branch
Git
git branch -D <branch>Delete remote branch
Git
git push origin --delete <branch>Rename current branch
Git
git branch -m <new-name>Merge a branch
Git
git merge <branch>Merge no fast-forward
Git
git merge --no-ff <branch>Abort a merge
Git
git merge --abortMerge squash
Git
git merge --squash <branch>Rebase onto branch
Git
git rebase <branch>Interactive rebase
Git
git rebase -i HEAD~<n>Abort rebase
Git
git rebase --abortContinue rebase
Git
git rebase --continueRebase onto
Git
git rebase --onto <new> <old> <branch>Stash changes
Git
git stashStash with message
Git
git stash push -m "message"Stash including untracked
Git
git stash -uApply stash
Git
git stash popList stashes
Git
git stash listApply specific stash
Git
git stash apply stash@{n}Drop a stash
Git
git stash drop stash@{n}Clear all stashes
Git
git stash clearView commit log
Git
git log --onelineLog with graph
Git
git log --oneline --graph --allLog last N commits
Git
git log -n <number>Log by author
Git
git log --author="name"Log since date
Git
git log --since="2024-01-01"Log file changes
Git
git log --follow -p <file>Show a commit
Git
git show <commit>Show files in commit
Git
git show --stat <commit>Reset to last commit (hard)
Git
git reset --hard HEADReset to last commit (soft)
Git
git reset --soft HEAD~1Reset to commit (mixed)
Git
git reset HEAD~1Unstage a file
Git
git reset HEAD <file>Restore file (new syntax)
Git
git restore <file>Unstage (new syntax)
Git
git restore --staged <file>Revert a commit
Git
git revert <commit>Cherry-pick a commit
Git
git cherry-pick <commit>Cherry-pick no commit
Git
git cherry-pick -n <commit>View diff
Git
git diffDiff staged changes
Git
git diff --stagedDiff between branches
Git
git diff <branch1>..<branch2>Diff stat only
Git
git diff --statDiff word-level
Git
git diff --word-diffBlame a file
Git
git blame <file>Create a tag
Git
git tag <tagname>Create annotated tag
Git
git tag -a v1.0 -m "message"Push tags
Git
git push --tagsDelete a tag
Git
git tag -d <tagname>Delete remote tag
Git
git push origin :refs/tags/<tag>List tags
Git
git tag -lList remotes
Git
git remote -vAdd a remote
Git
git remote add <name> <url>Remove a remote
Git
git remote remove <name>Change remote URL
Git
git remote set-url origin <url>Clean untracked files
Git
git clean -fdDry run clean
Git
git clean -fdnBisect start
Git
git bisect startBisect good/bad
Git
git bisect good / git bisect badBisect reset
Git
git bisect resetReflog
Git
git reflogWorktree add
Git
git worktree add <path> <branch>Worktree list
Git
git worktree listSubmodule add
Git
git submodule add <url>Submodule update
Git
git submodule update --init --recursiveSubmodule status
Git
git submodule statusConfig user name
Git
git config --global user.name "Name"Config user email
Git
git config --global user.email "email"List config
Git
git config --listSet default branch
Git
git config --global init.defaultBranch mainEnable auto-correct
Git
git config --global help.autocorrect 1Global gitignore
Git
git config --global core.excludesfile ~/.gitignore_globalShow short SHA
Git
git rev-parse --short HEADCount commits
Git
git rev-list --count HEADArchive a branch
Git
git archive --format=zip HEAD > archive.zipFind commit by message
Git
git log --grep="keyword"List files in commit
Git
git diff-tree --no-commit-id --name-only -r <commit>Show who changed file
Git
git shortlog -sn -- <file>List files
Terminal
ls -laList files (human sizes)
Terminal
ls -lahList sorted by time
Terminal
ls -ltList sorted by size
Terminal
ls -lSTree view
Terminal
tree -L 2Tree (dirs only)
Terminal
tree -d -L 3Change directory
Terminal
cd <path>Go to home
Terminal
cd ~Go back
Terminal
cd -Print working directory
Terminal
pwdCreate a directory
Terminal
mkdir -p <dir>Create a file
Terminal
touch <file>Remove a file
Terminal
rm <file>Remove directory recursively
Terminal
rm -rf <dir>Copy files
Terminal
cp <src> <dest>Copy directory
Terminal
cp -r <src> <dest>Move/rename files
Terminal
mv <src> <dest>View file contents
Terminal
cat <file>Concatenate files
Terminal
cat file1 file2 > combinedNumber lines
Terminal
cat -n <file>View with pager
Terminal
less <file>First N lines
Terminal
head -n 20 <file>Last N lines
Terminal
tail -n 20 <file>Follow log output
Terminal
tail -f <file>Word count
Terminal
wc -l <file>Search in files
Terminal
grep -r "pattern" <dir>Search case-insensitive
Terminal
grep -ri "pattern" <dir>Search with line numbers
Terminal
grep -rn "pattern" .Grep with context
Terminal
grep -C 3 "pattern" <file>Grep exclude dir
Terminal
grep -r --exclude-dir=node_modules "pattern" .Ripgrep search
Terminal
rg "pattern" --type tsFind files by name
Terminal
find . -name "*.ext"Find files by type
Terminal
find . -type f -name '*.log'Find and delete
Terminal
find . -name '*.tmp' -deleteFind large files
Terminal
find . -size +100MFind modified recently
Terminal
find . -mmin -60 -type fFind and exec
Terminal
find . -name '*.js' -exec wc -l {} +fd (find alternative)
Terminal
fd -e ts -e tsxDownload a file (curl)
Terminal
curl -O <url>Download a file (wget)
Terminal
wget <url>Curl with headers
Terminal
curl -H 'Authorization: Bearer <token>' <url>POST JSON with curl
Terminal
curl -X POST -H 'Content-Type: application/json' -d '{"key":"val"}' <url>Curl follow redirects
Terminal
curl -L <url>Curl verbose
Terminal
curl -v <url>Curl save to file
Terminal
curl -o output.txt <url>SSH into server
Terminal
ssh user@hostSSH with key
Terminal
ssh -i key.pem user@hostSSH tunnel
Terminal
ssh -L 8080:localhost:80 user@hostSSH reverse tunnel
Terminal
ssh -R 9090:localhost:3000 user@hostSCP file to remote
Terminal
scp file user@host:/pathSCP from remote
Terminal
scp user@host:/path/file .Rsync sync dirs
Terminal
rsync -avz src/ user@host:/dest/Rsync dry run
Terminal
rsync -avzn src/ dest/Change permissions
Terminal
chmod 755 <file>Change owner
Terminal
chown user:group <file>Make executable
Terminal
chmod +x <file>Recursive permissions
Terminal
chmod -R 644 <dir>Create tar archive
Terminal
tar -czf archive.tar.gz <dir>Extract tar archive
Terminal
tar -xzf archive.tar.gzList tar contents
Terminal
tar -tzf archive.tar.gzCreate zip
Terminal
zip -r archive.zip <dir>Extract zip
Terminal
unzip archive.zipDisk usage
Terminal
du -sh <dir>Disk usage sorted
Terminal
du -sh */ | sort -rhDisk free space
Terminal
df -hMemory usage
Terminal
free -hSystem info
Terminal
uname -aOS release info
Terminal
cat /etc/os-releaseCPU info
Terminal
lscpuTop processes
Terminal
topBetter top (htop)
Terminal
htopBottom (btm)
Terminal
btmKill a process
Terminal
kill -9 <pid>Kill by name
Terminal
killall <name>Find process by port
Terminal
lsof -i :<port>Find process by name
Terminal
ps aux | grep <name>Watch command
Terminal
watch -n 1 <command>Run in background
Terminal
<command> &Nohup background
Terminal
nohup <command> &Jobs list
Terminal
jobsBring to foreground
Terminal
fg %1Redirect stdout to file
Terminal
<command> > output.txtAppend to file
Terminal
<command> >> output.txtRedirect stderr
Terminal
<command> 2> errors.txtRedirect all output
Terminal
<command> &> all.txtPipe output
Terminal
<cmd1> | <cmd2>Tee (pipe + file)
Terminal
<command> | tee output.txtCommand history
Terminal
historySearch history
Terminal
history | grep <term>Reverse search
Terminal
Ctrl+RClear history
Terminal
history -cRun last command
Terminal
!!Run by history number
Terminal
!<number>Set environment variable
Terminal
export VAR=valuePrint env variable
Terminal
echo $VARAll env variables
Terminal
envUnset variable
Terminal
unset VARSource a file
Terminal
source ~/.bashrcAlias a command
Terminal
alias ll='ls -la'Which binary
Terminal
which <command>Type of command
Terminal
type <command>Check open ports
Terminal
netstat -tlnpSS (modern netstat)
Terminal
ss -tlnpDNS lookup
Terminal
nslookup <domain>Dig DNS query
Terminal
dig <domain>Ping a host
Terminal
ping -c 4 <host>Trace route
Terminal
traceroute <host>Public IP
Terminal
curl ifconfig.meLocal IP
Terminal
hostname -ISed replace in file
Terminal
sed -i 's/old/new/g' <file>Sed delete lines
Terminal
sed -i '1,5d' <file>Awk print column
Terminal
awk '{print $1}' <file>Awk with delimiter
Terminal
awk -F: '{print $1}' /etc/passwdCut columns
Terminal
cut -d',' -f1,3 <file>Sort output
Terminal
sort <file>Sort numeric
Terminal
sort -n <file>Unique lines
Terminal
sort <file> | uniqCount occurrences
Terminal
sort <file> | uniq -c | sort -rnxargs from stdin
Terminal
echo 'a b c' | xargs -n1Parallel xargs
Terminal
cat files.txt | xargs -P 4 -I {} cmd {}Symlink
Terminal
ln -s <target> <link>Current date/time
Terminal
dateDate formatted
Terminal
date +%Y-%m-%d_%H%M%SCalendar
Terminal
calEpoch timestamp
Terminal
date +%sGenerate SSH key
Terminal
ssh-keygen -t ed25519 -C "email"Add SSH key to agent
Terminal
ssh-add ~/.ssh/id_ed25519Check checksum
Terminal
sha256sum <file>MD5 checksum
Terminal
md5sum <file>Base64 encode
Terminal
echo -n 'text' | base64Base64 decode
Terminal
echo 'encoded' | base64 -dGenerate random string
Terminal
openssl rand -hex 32Generate UUID
Terminal
uuidgenJSON pretty print (jq)
Terminal
cat data.json | jq .jq filter
Terminal
cat data.json | jq '.key'Crontab edit
Terminal
crontab -eCrontab list
Terminal
crontab -lSystemd service status
Terminal
systemctl status <service>Systemd restart
Terminal
sudo systemctl restart <service>Systemd enable on boot
Terminal
sudo systemctl enable <service>Systemd logs
Terminal
journalctl -u <service> -fScreen new session
Terminal
screen -S <name>Tmux new session
Terminal
tmux new -s <name>Tmux attach
Terminal
tmux attach -t <name>Tmux list sessions
Terminal
tmux lsTmux split vertical
Terminal
Ctrl+B %Tmux split horizontal
Terminal
Ctrl+B "Diff two files
Terminal
diff <file1> <file2>Side-by-side diff
Terminal
diff -y <file1> <file2>Colored diff
Terminal
colordiff <file1> <file2>File type info
Terminal
file <file>Stat file details
Terminal
stat <file>Who is logged in
Terminal
whoUptime
Terminal
uptimeHex dump
Terminal
xxd <file> | headInitialize project
npm/yarn
npm init -yInstall all deps
npm/yarn
npm installAdd a package
npm/yarn
npm install <package>Add dev dependency
npm/yarn
npm install -D <package>Add global package
npm/yarn
npm install -g <package>Add exact version
npm/yarn
npm install <package>@1.2.3Remove a package
npm/yarn
npm uninstall <package>Run a script
npm/yarn
npm run <script>Start dev server
npm/yarn
npm run devBuild for production
npm/yarn
npm run buildRun tests
npm/yarn
npm testRun tests in watch
npm/yarn
npm test -- --watchUpdate all packages
npm/yarn
npm updateCheck outdated
npm/yarn
npm outdatedAudit vulnerabilities
npm/yarn
npm auditFix audit issues
npm/yarn
npm audit fixList installed
npm/yarn
npm list --depth=0List global packages
npm/yarn
npm list -g --depth=0View package info
npm/yarn
npm info <package>View package versions
npm/yarn
npm view <package> versionsCache clean
npm/yarn
npm cache clean --forceRun with npx
npm/yarn
npx <package>npx with version
npm/yarn
npx <package>@latestCreate React app (Vite)
npm/yarn
npm create vite@latest my-appCreate Next.js app
npm/yarn
npx create-next-app@latestCreate Astro project
npm/yarn
npm create astro@latestCreate SvelteKit
npm/yarn
npm create svelte@latest my-appCreate Remix app
npm/yarn
npx create-remix@latestCreate Nuxt app
npm/yarn
npx nuxi init my-appCreate T3 Stack
npm/yarn
npm create t3-app@latestPublish to npm
npm/yarn
npm publishPublish dry run
npm/yarn
npm publish --dry-runLogin to npm
npm/yarn
npm loginWhoami npm
npm/yarn
npm whoamiLink local package
npm/yarn
npm linkUnlink package
npm/yarn
npm unlink <package>Pack preview
npm/yarn
npm packBump patch version
npm/yarn
npm version patchBump minor version
npm/yarn
npm version minorBump major version
npm/yarn
npm version majornpm ci (clean install)
npm/yarn
npm ciDeduplicate deps
npm/yarn
npm dedupeWhy is pkg installed
npm/yarn
npm explain <package>Yarn add
npm/yarn
yarn add <package>Yarn add dev
npm/yarn
yarn add -D <package>Yarn remove
npm/yarn
yarn remove <package>Yarn install
npm/yarn
yarn installYarn upgrade
npm/yarn
yarn upgradeYarn upgrade interactive
npm/yarn
yarn upgrade-interactiveYarn why
npm/yarn
yarn why <package>pnpm install
npm/yarn
pnpm installpnpm add
npm/yarn
pnpm add <package>pnpm add dev
npm/yarn
pnpm add -D <package>pnpm remove
npm/yarn
pnpm remove <package>pnpm store prune
npm/yarn
pnpm store prunepnpm why
npm/yarn
pnpm why <package>Bun install
npm/yarn
bun installBun add
npm/yarn
bun add <package>Bun add dev
npm/yarn
bun add -D <package>Bun run
npm/yarn
bun run <script>Bun create
npm/yarn
bun create <template>Bun test
npm/yarn
bun testBun build
npm/yarn
bun build ./src/index.ts --outdir ./distCheck Node version
npm/yarn
node -vCheck npm version
npm/yarn
npm -vUse nvm to switch Node
npm/yarn
nvm use <version>Install Node via nvm
npm/yarn
nvm install <version>List nvm versions
npm/yarn
nvm lsSet default nvm
npm/yarn
nvm alias default <version>Volta install Node
npm/yarn
volta install node@<version>Volta pin
npm/yarn
volta pin node@<version>npm init with scope
npm/yarn
npm init --scope=@orgnpm config set registry
npm/yarn
npm config set registry <url>Build an image
Docker
docker build -t <name> .Build with no cache
Docker
docker build --no-cache -t <name> .Build with build args
Docker
docker build --build-arg KEY=val -t <name> .Build multi-stage
Docker
docker build --target production -t <name> .Build for platform
Docker
docker build --platform linux/amd64 -t <name> .Buildx multi-arch
Docker
docker buildx build --platform linux/amd64,linux/arm64 -t <name> --push .Run a container
Docker
docker run -d -p 3000:3000 <image>Run interactive
Docker
docker run -it <image> bashRun with env vars
Docker
docker run -e KEY=val <image>Run with volume
Docker
docker run -v /host:/container <image>Run with name
Docker
docker run --name <name> <image>Run with auto-remove
Docker
docker run --rm <image>Run with env file
Docker
docker run --env-file .env <image>Run with network
Docker
docker run --network <name> <image>Run with memory limit
Docker
docker run -m 512m <image>Run with CPU limit
Docker
docker run --cpus=2 <image>Run with restart policy
Docker
docker run --restart unless-stopped <image>List running containers
Docker
docker psList all containers
Docker
docker ps -aList container IDs
Docker
docker ps -qStop a container
Docker
docker stop <id>Stop all containers
Docker
docker stop $(docker ps -q)Start a container
Docker
docker start <id>Restart a container
Docker
docker restart <id>Remove a container
Docker
docker rm <id>Remove all stopped
Docker
docker container pruneForce remove container
Docker
docker rm -f <id>List images
Docker
docker imagesRemove an image
Docker
docker rmi <image>Remove dangling images
Docker
docker image pruneRemove all images
Docker
docker rmi $(docker images -q)Pull an image
Docker
docker pull <image>Push an image
Docker
docker push <image>Tag an image
Docker
docker tag <image> <repo>:<tag>Image history
Docker
docker history <image>Execute in container
Docker
docker exec -it <id> bashExecute as root
Docker
docker exec -it -u root <id> bashView container logs
Docker
docker logs <id>Follow logs
Docker
docker logs -f <id>Logs since time
Docker
docker logs --since 1h <id>Logs with timestamps
Docker
docker logs -t <id>Inspect container
Docker
docker inspect <id>Inspect format IP
Docker
docker inspect -f '{{.NetworkSettings.IPAddress}}' <id>Copy to container
Docker
docker cp file <id>:/pathCopy from container
Docker
docker cp <id>:/path fileView resource usage
Docker
docker statsContainer top processes
Docker
docker top <id>Diff container changes
Docker
docker diff <id>Commit container as image
Docker
docker commit <id> <new-image>Wait for container exit
Docker
docker wait <id>Rename container
Docker
docker rename <old> <new>Compose up
Docker
docker compose up -dCompose up with build
Docker
docker compose up -d --buildCompose up specific
Docker
docker compose up -d <service>Compose down
Docker
docker compose downCompose down + volumes
Docker
docker compose down -vCompose down + images
Docker
docker compose down --rmi allCompose logs
Docker
docker compose logs -fCompose logs service
Docker
docker compose logs -f <service>Compose ps
Docker
docker compose psCompose exec
Docker
docker compose exec <service> bashCompose restart
Docker
docker compose restart <service>Compose pull
Docker
docker compose pullCompose build
Docker
docker compose buildCompose scale
Docker
docker compose up -d --scale <service>=3Compose config validate
Docker
docker compose configCompose top
Docker
docker compose topList volumes
Docker
docker volume lsCreate volume
Docker
docker volume create <name>Remove volume
Docker
docker volume rm <name>Inspect volume
Docker
docker volume inspect <name>List networks
Docker
docker network lsCreate network
Docker
docker network create <name>Inspect network
Docker
docker network inspect <name>Connect to network
Docker
docker network connect <net> <container>Disconnect from network
Docker
docker network disconnect <net> <container>Prune everything
Docker
docker system prune -aPrune with volumes
Docker
docker system prune -a --volumesDisk usage
Docker
docker system dfDisk usage verbose
Docker
docker system df -vLogin to registry
Docker
docker loginLogin to custom registry
Docker
docker login <registry-url>Save image to tar
Docker
docker save -o image.tar <image>Load image from tar
Docker
docker load -i image.tarDocker events
Docker
docker eventsDocker version
Docker
docker versionDocker info
Docker
docker infoInstall Ollama
AI
curl -fsSL https://ollama.com/install.sh | shRun a model (Ollama)
AI
ollama run llama3Pull a model
AI
ollama pull mistralList local models
AI
ollama listRemove a model
AI
ollama rm <model>Show model info
AI
ollama show llama3Serve Ollama API
AI
ollama serveCreate custom model
AI
ollama create mymodel -f ModelfileCopy a model
AI
ollama cp llama3 my-llama3Ollama API generate
AI
curl http://localhost:11434/api/generate -d '{"model":"llama3","prompt":"hello"}'Ollama API chat
AI
curl http://localhost:11434/api/chat -d '{"model":"llama3","messages":[{"role":"user","content":"hi"}]}'Ollama pull with progress
AI
ollama pull codellamaOllama run with system
AI
ollama run llama3 --system "You are helpful"Ollama embeddings
AI
curl http://localhost:11434/api/embeddings -d '{"model":"llama3","prompt":"text"}'Install OpenAI CLI
AI
pip install openaiSet OpenAI API key
AI
export OPENAI_API_KEY='sk-...'Chat completion (curl)
AI
curl https://api.openai.com/v1/chat/completions -H 'Authorization: Bearer $OPENAI_API_KEY' -H 'Content-Type: application/json' -d '{"model":"gpt-4","messages":[{"role":"user","content":"hello"}]}'List OpenAI models
AI
curl https://api.openai.com/v1/models -H 'Authorization: Bearer $OPENAI_API_KEY'Generate embeddings
AI
curl https://api.openai.com/v1/embeddings -H 'Authorization: Bearer $OPENAI_API_KEY' -d '{"model":"text-embedding-3-small","input":"text"}'OpenAI image generation
AI
curl https://api.openai.com/v1/images/generations -H 'Authorization: Bearer $OPENAI_API_KEY' -d '{"model":"dall-e-3","prompt":"a cat"}'OpenAI TTS
AI
curl https://api.openai.com/v1/audio/speech -H 'Authorization: Bearer $OPENAI_API_KEY' -d '{"model":"tts-1","input":"Hello","voice":"alloy"}' --output speech.mp3OpenAI Whisper
AI
curl https://api.openai.com/v1/audio/transcriptions -H 'Authorization: Bearer $OPENAI_API_KEY' -F file=@audio.mp3 -F model=whisper-1Install Anthropic SDK
AI
pip install anthropicSet Anthropic key
AI
export ANTHROPIC_API_KEY='sk-ant-...'Claude API (curl)
AI
curl https://api.anthropic.com/v1/messages -H 'x-api-key: $ANTHROPIC_API_KEY' -H 'anthropic-version: 2023-06-01' -H 'Content-Type: application/json' -d '{"model":"claude-sonnet-4-20250514","max_tokens":1024,"messages":[{"role":"user","content":"hello"}]}'Install HF CLI
AI
pip install huggingface_hubLogin to HF
AI
huggingface-cli loginDownload HF model
AI
huggingface-cli download <model-id>Upload to HF
AI
huggingface-cli upload <repo-id> <local-path>HF model info
AI
huggingface-cli repo info <model-id>List HF cache
AI
huggingface-cli scan-cacheDelete HF cache
AI
huggingface-cli delete-cacheCreate HF repo
AI
huggingface-cli repo create <name> --type modelInstall PyTorch
AI
pip install torch torchvision torchaudioInstall PyTorch (CUDA)
AI
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121Install TensorFlow
AI
pip install tensorflowInstall Transformers
AI
pip install transformersInstall LangChain
AI
pip install langchain langchain-openaiInstall LlamaIndex
AI
pip install llama-indexInstall llama-cpp-python
AI
pip install llama-cpp-pythonInstall vLLM
AI
pip install vllmInstall Gradio
AI
pip install gradioInstall Streamlit
AI
pip install streamlitInstall LiteLLM
AI
pip install litellmInstall Sentence Transformers
AI
pip install sentence-transformersInstall FAISS
AI
pip install faiss-cpuInstall FAISS GPU
AI
pip install faiss-gpuInstall ChromaDB
AI
pip install chromadbInstall Pinecone
AI
pip install pinecone-clientInstall Weaviate
AI
pip install weaviate-clientInstall Qdrant
AI
pip install qdrant-clientInstall spaCy
AI
pip install spacyDownload spaCy model
AI
python -m spacy download en_core_web_smInstall scikit-learn
AI
pip install scikit-learnInstall pandas
AI
pip install pandasInstall matplotlib
AI
pip install matplotlib seabornInstall OpenCV
AI
pip install opencv-pythonInstall Pillow
AI
pip install PillowInstall datasets
AI
pip install datasetsInstall accelerate
AI
pip install accelerateInstall PEFT (LoRA)
AI
pip install peftInstall bitsandbytes
AI
pip install bitsandbytesInstall trl (RLHF)
AI
pip install trlInstall unsloth
AI
pip install unslothServe model with vLLM
AI
python -m vllm.entrypoints.openai.api_server --model <model>vLLM with quantization
AI
python -m vllm.entrypoints.openai.api_server --model <model> --quantization awqRun Gradio app
AI
python app.py # gradio interfaceRun Streamlit app
AI
streamlit run app.pyLiteLLM proxy
AI
litellm --model ollama/llama3 --port 8000TGI (HF Inference)
AI
docker run --gpus all -p 8080:80 ghcr.io/huggingface/text-generation-inference --model-id <model>Build llama.cpp
AI
cmake -B build && cmake --build build --config ReleaseBuild llama.cpp CUDA
AI
cmake -B build -DGGML_CUDA=ON && cmake --build build --config ReleaseRun llama.cpp
AI
./build/bin/llama-cli -m model.gguf -p 'Hello' -n 128Quantize model (llama.cpp)
AI
./build/bin/llama-quantize model.gguf model-q4.gguf Q4_K_Mllama.cpp server
AI
./build/bin/llama-server -m model.gguf --port 8080Convert HF to GGUF
AI
python convert_hf_to_gguf.py <model-dir>Check CUDA version
AI
nvcc --versionCheck GPU (nvidia)
AI
nvidia-smiWatch GPU usage
AI
watch -n 1 nvidia-smiPython check PyTorch GPU
AI
python -c "import torch; print(torch.cuda.is_available())"Check TF GPU
AI
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"Create venv for ML
AI
python -m venv .venv && source .venv/bin/activateConda create env
AI
conda create -n ml python=3.11 -yConda activate
AI
conda activate mlConda list envs
AI
conda env listConda install
AI
conda install <package>Freeze requirements
AI
pip freeze > requirements.txtInstall from requirements
AI
pip install -r requirements.txtUV pip install
AI
uv pip install <package>UV venv create
AI
uv venvJupyter notebook
AI
jupyter notebookJupyterLab
AI
jupyter labInstall Jupyter
AI
pip install jupyterlab notebookWeights & Biases login
AI
wandb loginInstall W&B
AI
pip install wandbMLflow UI
AI
mlflow ui --port 5000Install MLflow
AI
pip install mlflowTensorboard
AI
tensorboard --logdir=./logsInstall Tensorboard
AI
pip install tensorboardDVC init
AI
dvc initDVC add data
AI
dvc add data/DVC push
AI
dvc pushInstall DVC
AI
pip install dvcAWS configure credentials
Cloud & Deploy
Set access key, secret, region and output format.
aws configureAWS configure named profile
Cloud & Deploy
aws configure --profile <name>AWS whoami
Cloud & Deploy
Show the account and IAM identity in use.
aws sts get-caller-identityList S3 buckets
Cloud & Deploy
aws s3 lsList S3 bucket contents
Cloud & Deploy
aws s3 ls s3://<bucket>/<prefix>/Copy file to S3
Cloud & Deploy
aws s3 cp ./<file> s3://<bucket>/<key>Sync folder to S3
Cloud & Deploy
--delete removes remote files missing locally.
aws s3 sync ./dist s3://<bucket> --deleteDestructive
Presign S3 download URL
Cloud & Deploy
aws s3 presign s3://<bucket>/<key> --expires-in 3600Delete S3 object
Cloud & Deploy
aws s3 rm s3://<bucket>/<key>Destructive
Invalidate CloudFront cache
Cloud & Deploy
aws cloudfront create-invalidation --distribution-id <id> --paths "/*"List EC2 instances
Cloud & Deploy
aws ec2 describe-instances --query "Reservations[].Instances[].[InstanceId,State.Name,PublicIpAddress]" --output tableStart EC2 instance
Cloud & Deploy
aws ec2 start-instances --instance-ids <id>Stop EC2 instance
Cloud & Deploy
aws ec2 stop-instances --instance-ids <id>Destructive
List Lambda functions
Cloud & Deploy
aws lambda list-functions --query "Functions[].FunctionName"Invoke Lambda function
Cloud & Deploy
aws lambda invoke --function-name <name> --payload '{}' out.jsonTail Lambda logs
Cloud & Deploy
aws logs tail /aws/lambda/<name> --followDeploy Lambda zip
Cloud & Deploy
aws lambda update-function-code --function-name <name> --zip-file fileb://function.zipLogin to ECR
Cloud & Deploy
aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <acct>.dkr.ecr.<region>.amazonaws.comCreate ECR repository
Cloud & Deploy
aws ecr create-repository --repository-name <name>List ECR images
Cloud & Deploy
aws ecr list-images --repository-name <name>Deploy CloudFormation stack
Cloud & Deploy
aws cloudformation deploy --template-file template.yml --stack-name <name> --capabilities CAPABILITY_IAMDelete CloudFormation stack
Cloud & Deploy
aws cloudformation delete-stack --stack-name <name>Destructive
Read SSM parameter
Cloud & Deploy
aws ssm get-parameter --name <name> --with-decryption --query Parameter.Value --output textRead Secrets Manager secret
Cloud & Deploy
aws secretsmanager get-secret-value --secret-id <id> --query SecretString --output textgcloud login
Cloud & Deploy
gcloud auth logingcloud set project
Cloud & Deploy
gcloud config set project <project-id>List gcloud projects
Cloud & Deploy
gcloud projects listDeploy to Cloud Run
Cloud & Deploy
gcloud run deploy <service> --source . --region <region> --allow-unauthenticatedList Cloud Run services
Cloud & Deploy
gcloud run services listTail Cloud Run logs
Cloud & Deploy
gcloud beta run services logs tail <service> --region <region>Build with Cloud Build
Cloud & Deploy
gcloud builds submit --tag gcr.io/<project>/<image>List GCS buckets
Cloud & Deploy
gsutil lsCopy to GCS
Cloud & Deploy
gsutil cp ./<file> gs://<bucket>/Sync folder to GCS
Cloud & Deploy
gsutil -m rsync -r ./dist gs://<bucket>Configure docker for GCR
Cloud & Deploy
gcloud auth configure-dockerAzure login
Cloud & Deploy
az loginSet Azure subscription
Cloud & Deploy
az account set --subscription <id>List Azure resource groups
Cloud & Deploy
az group list --output tableDeploy Azure web app
Cloud & Deploy
az webapp up --name <app> --runtime "NODE:20-lts"Tail Azure web app logs
Cloud & Deploy
az webapp log tail --name <app> --resource-group <group>Push to Azure container registry
Cloud & Deploy
az acr build --registry <registry> --image <image>:<tag> .Deploy preview to Vercel
Cloud & Deploy
vercelDeploy to Vercel production
Cloud & Deploy
vercel --prodLink local dir to Vercel project
Cloud & Deploy
vercel linkPull Vercel env vars
Cloud & Deploy
vercel env pull .env.localAdd Vercel env var
Cloud & Deploy
vercel env add <NAME> productionList Vercel deployments
Cloud & Deploy
vercel lsVercel deployment logs
Cloud & Deploy
vercel logs <deployment-url>Rollback Vercel deployment
Cloud & Deploy
vercel rollback <deployment-url>Deploy to Netlify
Cloud & Deploy
netlify deploy --prod --dir=distNetlify dev server
Cloud & Deploy
netlify devLink Netlify site
Cloud & Deploy
netlify linkNetlify function logs
Cloud & Deploy
netlify functions:log <name>Launch a Fly.io app
Cloud & Deploy
fly launchDeploy to Fly.io
Cloud & Deploy
fly deployFly.io logs
Cloud & Deploy
fly logsFly.io SSH console
Cloud & Deploy
fly ssh consoleScale Fly.io machines
Cloud & Deploy
fly scale count 2Set Fly.io secret
Cloud & Deploy
fly secrets set <NAME>=<value>Deploy Cloudflare Worker
Cloud & Deploy
wrangler deployCloudflare Worker dev server
Cloud & Deploy
wrangler devTail Cloudflare Worker logs
Cloud & Deploy
wrangler tailSet Cloudflare Worker secret
Cloud & Deploy
wrangler secret put <NAME>Deploy Cloudflare Pages
Cloud & Deploy
wrangler pages deploy ./distQuery Cloudflare D1
Cloud & Deploy
wrangler d1 execute <db> --command "SELECT 1"Upload to R2
Cloud & Deploy
wrangler r2 object put <bucket>/<key> --file ./<file>Create Heroku app
Cloud & Deploy
heroku create <app>Deploy to Heroku
Cloud & Deploy
git push heroku mainHeroku logs
Cloud & Deploy
heroku logs --tail --app <app>Set Heroku config var
Cloud & Deploy
heroku config:set <NAME>=<value> --app <app>Run one-off Heroku command
Cloud & Deploy
heroku run bash --app <app>Railway deploy
Cloud & Deploy
railway upRender deploy hook
Cloud & Deploy
curl -X POST "<render-deploy-hook-url>"Supabase local start
Cloud & Deploy
supabase startDeploy Supabase edge function
Cloud & Deploy
supabase functions deploy <name>Copy build to server over SSH
Cloud & Deploy
scp -r ./dist <user>@<host>:/var/www/appDeploy with rsync over SSH
Cloud & Deploy
rsync -avz --delete ./dist/ <user>@<host>:/var/www/app/Destructive
Run remote deploy script
Cloud & Deploy
ssh <user>@<host> 'cd /srv/app && ./deploy.sh'Show kubectl contexts
Kubernetes
kubectl config get-contextsSwitch kubectl context
Kubernetes
kubectl config use-context <context>Set default namespace
Kubernetes
kubectl config set-context --current --namespace=<ns>List pods
Kubernetes
kubectl get podsList pods in all namespaces
Kubernetes
kubectl get pods -A -o wideWatch pods
Kubernetes
kubectl get pods -wDescribe a pod
Kubernetes
kubectl describe pod <pod>Pod logs
Kubernetes
kubectl logs <pod>Follow pod logs
Kubernetes
kubectl logs -f <pod> -c <container>Previous container logs
Kubernetes
Read logs from the crashed instance of a restarting pod.
kubectl logs <pod> --previousShell into a pod
Kubernetes
kubectl exec -it <pod> -- /bin/shPort-forward a pod
Kubernetes
kubectl port-forward pod/<pod> 8080:80Port-forward a service
Kubernetes
kubectl port-forward svc/<service> 8080:80Apply a manifest
Kubernetes
kubectl apply -f <file>.yamlApply a directory of manifests
Kubernetes
kubectl apply -f ./k8s/Delete resources from manifest
Kubernetes
kubectl delete -f <file>.yamlDestructive
Restart a deployment
Kubernetes
kubectl rollout restart deployment/<name>Rollout status
Kubernetes
kubectl rollout status deployment/<name>Rollback a deployment
Kubernetes
kubectl rollout undo deployment/<name>Rollout history
Kubernetes
kubectl rollout history deployment/<name>Scale a deployment
Kubernetes
kubectl scale deployment/<name> --replicas=3Autoscale a deployment
Kubernetes
kubectl autoscale deployment/<name> --min=2 --max=10 --cpu-percent=70Set container image
Kubernetes
kubectl set image deployment/<name> <container>=<image>:<tag>Edit a resource live
Kubernetes
kubectl edit deployment/<name>Get resource YAML
Kubernetes
kubectl get deployment/<name> -o yamlCluster events by time
Kubernetes
kubectl get events --sort-by=.lastTimestampTop pods by resource use
Kubernetes
kubectl top podsTop nodes by resource use
Kubernetes
kubectl top nodesList nodes
Kubernetes
kubectl get nodes -o wideDrain a node
Kubernetes
kubectl drain <node> --ignore-daemonsets --delete-emptydir-dataDestructive
Cordon a node
Kubernetes
kubectl cordon <node>Uncordon a node
Kubernetes
kubectl uncordon <node>Create secret from literals
Kubernetes
kubectl create secret generic <name> --from-literal=KEY=valueDecode a secret
Kubernetes
kubectl get secret <name> -o jsonpath="{.data.KEY}" | base64 -dCreate configmap from file
Kubernetes
kubectl create configmap <name> --from-file=./config.yamlCopy file out of a pod
Kubernetes
kubectl cp <ns>/<pod>:/path/file ./fileRun a debug pod
Kubernetes
kubectl run tmp --rm -it --image=busybox -- shDebug a running pod
Kubernetes
kubectl debug -it <pod> --image=busybox --target=<container>Explain a resource field
Kubernetes
kubectl explain deployment.spec.templateDry-run a manifest
Kubernetes
kubectl apply -f <file>.yaml --dry-run=serverInstall a Helm chart
Kubernetes
helm install <release> <chart>Upgrade or install Helm release
Kubernetes
helm upgrade --install <release> <chart> -f values.yamlList Helm releases
Kubernetes
helm list -ARender Helm templates
Kubernetes
helm template <release> <chart> -f values.yamlRollback Helm release
Kubernetes
helm rollback <release> <revision>Uninstall Helm release
Kubernetes
helm uninstall <release>Destructive
Add Helm repo
Kubernetes
helm repo add <name> <url> && helm repo updateBuild kustomize output
Kubernetes
kubectl kustomize ./overlays/prodApply kustomize overlay
Kubernetes
kubectl apply -k ./overlays/prodStart minikube
Kubernetes
minikube startOpen minikube dashboard
Kubernetes
minikube dashboardLoad image into minikube
Kubernetes
minikube image load <image>:<tag>Create kind cluster
Kubernetes
kind create cluster --name <name>Open k9s dashboard
Kubernetes
k9sTerraform init
DevOps
terraform initTerraform format
DevOps
terraform fmt -recursiveTerraform validate
DevOps
terraform validateTerraform plan to file
DevOps
terraform plan -out=tfplanTerraform apply plan
DevOps
terraform apply tfplanTerraform destroy
DevOps
terraform destroyDestructive
Terraform show state
DevOps
terraform state listTerraform import resource
DevOps
terraform import <address> <id>Terraform target apply
DevOps
terraform apply -target=<address>Terraform workspace switch
DevOps
terraform workspace select <name>Terraform output value
DevOps
terraform output -raw <name>Ansible ping hosts
DevOps
ansible all -m ping -i inventory.iniRun Ansible playbook
DevOps
ansible-playbook -i inventory.ini site.ymlAnsible dry run
DevOps
ansible-playbook -i inventory.ini site.yml --check --diffInstall Ansible roles
DevOps
ansible-galaxy install -r requirements.ymlEncrypt Ansible vault file
DevOps
ansible-vault encrypt group_vars/prod/vault.ymlPacker build image
DevOps
packer build template.pkr.hclPulumi deploy stack
DevOps
pulumi upConnect to Postgres
Databases
psql "postgresql://<user>:<pass>@<host>:5432/<db>"Run SQL file against Postgres
Databases
psql -d <db> -f ./schema.sqlRun one-off SQL query
Databases
psql -d <db> -c "SELECT count(*) FROM users;"List Postgres tables
Databases
\dtDescribe Postgres table
Databases
\d+ <table>List Postgres databases
Databases
\lToggle expanded output
Databases
\xDump a Postgres database
Databases
pg_dump -Fc <db> > backup.dumpDump schema only
Databases
pg_dump --schema-only <db> > schema.sqlRestore a Postgres dump
Databases
pg_restore -d <db> --clean --if-exists backup.dumpDestructive
Create Postgres database
Databases
createdb <db>Drop Postgres database
Databases
dropdb <db>Destructive
Show running Postgres queries
Databases
SELECT pid, state, query FROM pg_stat_activity WHERE state <> 'idle';Cancel a Postgres query
Databases
SELECT pg_cancel_backend(<pid>);Table sizes in Postgres
Databases
SELECT relname, pg_size_pretty(pg_total_relation_size(relid)) FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;Explain a slow query
Databases
EXPLAIN ANALYZE SELECT * FROM <table> WHERE <cond>;Vacuum and analyze
Databases
VACUUM (ANALYZE, VERBOSE) <table>;Connect to MySQL
Databases
mysql -h <host> -u <user> -p <db>Dump a MySQL database
Databases
mysqldump -u <user> -p <db> > backup.sqlRestore a MySQL dump
Databases
mysql -u <user> -p <db> < backup.sqlDestructive
Show MySQL tables
Databases
SHOW TABLES;Describe MySQL table
Databases
DESCRIBE <table>;Show MySQL processlist
Databases
SHOW FULL PROCESSLIST;Connect to MongoDB
Databases
mongosh "mongodb://<host>:27017/<db>"List Mongo collections
Databases
show collectionsFind Mongo documents
Databases
db.<collection>.find({ <field>: <value> }).limit(10)Count Mongo documents
Databases
db.<collection>.countDocuments({})Create Mongo index
Databases
db.<collection>.createIndex({ <field>: 1 })Dump MongoDB
Databases
mongodump --uri="mongodb://<host>/<db>" --out=./dumpRestore MongoDB
Databases
mongorestore --uri="mongodb://<host>" ./dumpDestructive
Connect to Redis
Databases
redis-cli -h <host> -p 6379Redis key count
Databases
redis-cli DBSIZEScan Redis keys by prefix
Databases
redis-cli --scan --pattern '<prefix>*'Get Redis key TTL
Databases
redis-cli TTL <key>Monitor Redis commands
Databases
redis-cli MONITORFlush a Redis database
Databases
redis-cli FLUSHDBDestructive
Open SQLite database
Databases
sqlite3 <file>.dbList SQLite tables
Databases
.tablesShow SQLite schema
Databases
.schema <table>Dump SQLite database
Databases
sqlite3 <file>.db .dump > dump.sqlExport SQLite query to CSV
Databases
sqlite3 -header -csv <file>.db "SELECT * FROM <table>;" > out.csvPrisma generate client
Databases
npx prisma generatePrisma create migration
Databases
npx prisma migrate dev --name <name>Prisma deploy migrations
Databases
npx prisma migrate deployPrisma reset database
Databases
npx prisma migrate resetDestructive
Prisma push schema
Databases
npx prisma db pushOpen Prisma Studio
Databases
npx prisma studioDrizzle generate migration
Databases
npx drizzle-kit generateDrizzle push schema
Databases
npx drizzle-kit pushOpen Drizzle Studio
Databases
npx drizzle-kit studioRun Postgres in Docker
Databases
docker run --name pg -e POSTGRES_PASSWORD=<pass> -p 5432:5432 -d postgres:16Run Redis in Docker
Databases
docker run --name redis -p 6379:6379 -d redis:7Run MySQL in Docker
Databases
docker run --name mysql -e MYSQL_ROOT_PASSWORD=<pass> -p 3306:3306 -d mysql:8Add a git worktree
Git
Check out another branch in a second folder without stashing.
git worktree add ../<dir> <branch>List git worktrees
Git
git worktree listRemove a git worktree
Git
git worktree remove ../<dir>Start a bisect session
Git
git bisect startMark bisect good/bad
Git
git bisect good <sha> && git bisect bad <sha>Automate bisect with a script
Git
git bisect run npm testEnd a bisect session
Git
git bisect resetShow reflog
Git
Find commits that seem lost after a reset or rebase.
git reflogRecover a commit from reflog
Git
git reset --hard <reflog-sha>Destructive
Clone with submodules
Git
git clone --recurse-submodules <repo-url>Init and update submodules
Git
git submodule update --init --recursiveUpdate submodules to remote
Git
git submodule update --remote --mergeSparse checkout a subfolder
Git
git sparse-checkout set <dir>Enable sparse checkout (cone)
Git
git sparse-checkout init --coneSearch commit messages
Git
git log --grep="<text>"Find when a line changed
Git
git log -S"<code snippet>" --onelineBlame with line ranges
Git
git blame -L 10,40 <file>Show a file at a revision
Git
git show <sha>:<path>Restore a file from a commit
Git
git checkout <sha> -- <path>Diff against a branch
Git
git diff <branch>...HEADDiff only file names
Git
git diff --name-only <branch>Rebase interactively onto main
Git
git rebase -i origin/mainContinue an interrupted rebase
Git
git rebase --continueAbort a rebase
Git
git rebase --abortForce push safely
Git
Fails instead of overwriting someone else's new commits.
git push --force-with-leaseDestructive
Prune deleted remote branches
Git
git fetch --pruneDelete merged local branches
Git
git branch --merged main | grep -v main | xargs -r git branch -dDestructive
Rename current branch
Git
git branch -m <new-name>Create an annotated tag
Git
git tag -a v1.0.0 -m "release 1.0.0"Push all tags
Git
git push --tagsDelete a remote tag
Git
git push origin :refs/tags/<tag>Destructive
Cherry-pick a range
Git
git cherry-pick <start-sha>^..<end-sha>Stash including untracked
Git
git stash push -u -m "<message>"Apply a specific stash
Git
git stash apply stash@{1}Show stash contents
Git
git stash show -p stash@{0}Create a patch file
Git
git format-patch -1 <sha>Apply a patch file
Git
git apply <file>.patchArchive repo as zip
Git
git archive --format=zip HEAD -o source.zipRepo size and object count
Git
git count-objects -vHGarbage collect aggressively
Git
git gc --aggressive --prune=nowSet commit signing key
Git
git config --global user.signingkey <key-id>Sign commits by default
Git
git config --global commit.gpgsign trueIgnore file mode changes
Git
git config core.fileMode falseShow config origin
Git
git config --list --show-originAlias a git command
Git
git config --global alias.lg "log --oneline --graph --decorate"Sum a column with awk
Terminal
awk '{ sum += $2 } END { print sum }' <file>Print selected columns
Terminal
awk '{ print $1, $3 }' <file>Filter rows with awk
Terminal
awk '$3 > 100' <file>Replace text in place
Terminal
sed -i 's/old/new/g' <file>DestructiveLinux
Replace text in place (macOS)
Terminal
sed -i '' 's/old/new/g' <file>DestructivemacOS
Print a line range
Terminal
sed -n '10,20p' <file>Delete matching lines
Terminal
sed '/<pattern>/d' <file>Bulk rename with xargs
Terminal
ls *.txt | xargs -I{} mv {} {}.bakParallel jobs with xargs
Terminal
cat urls.txt | xargs -P 8 -n 1 curl -sOFind and delete safely
Terminal
find . -name "*.log" -mtime +7 -print -deleteDestructive
Find large files
Terminal
find . -type f -size +100M -exec ls -lh {} \;Find and replace across repo
Terminal
rg -l "<old>" | xargs sed -i 's/<old>/<new>/g'Destructive
Search with ripgrep
Terminal
rg -n "<pattern>" src/Ripgrep only file names
Terminal
rg -l "<pattern>"Count matches
Terminal
rg -c "<pattern>"Who is using a port
Terminal
lsof -i :3000macOSLinux
Kill process on a port
Terminal
kill -9 $(lsof -t -i:3000)Destructive
List listening sockets
Terminal
ss -tulpnLinux
DNS lookup
Terminal
dig +short <domain>Trace DNS resolution
Terminal
dig <domain> +traceCheck certificate expiry
Terminal
echo | openssl s_client -connect <host>:443 2>/dev/null | openssl x509 -noout -datesGenerate a random secret
Terminal
openssl rand -base64 32Hash a file
Terminal
shasum -a 256 <file>Generate an SSH key
Terminal
ssh-keygen -t ed25519 -C "<email>"Copy SSH key to server
Terminal
ssh-copy-id <user>@<host>SSH tunnel a remote port
Terminal
ssh -L 5432:localhost:5432 <user>@<host>Time a command
Terminal
time <command>Run command every 2 seconds
Terminal
watch -n 2 '<command>'Linux
Follow a log file
Terminal
tail -f -n 100 <file>Follow and filter a log
Terminal
tail -f <file> | grep --line-buffered "ERROR"Disk usage by folder
Terminal
du -sh * | sort -hFree disk space
Terminal
df -hTop processes by memory
Terminal
ps aux --sort=-%mem | head -n 15Linux
Run in background with nohup
Terminal
nohup <command> > out.log 2>&1 &List background jobs
Terminal
jobs -lBring job to foreground
Terminal
fg %1New tmux session
Terminal
tmux new -s <name>Attach tmux session
Terminal
tmux attach -t <name>List tmux sessions
Terminal
tmux lsPretty-print JSON
Terminal
cat <file>.json | jq .Extract JSON field
Terminal
jq -r '.items[].name' <file>.jsonFilter JSON array
Terminal
jq '.[] | select(.status == "active")' <file>.jsonConvert JSON to CSV
Terminal
jq -r '.[] | [.id, .name] | @csv' <file>.jsonParse YAML with yq
Terminal
yq '.services.web.image' docker-compose.ymlCompress a folder
Terminal
tar -czf archive.tar.gz <dir>Extract an archive
Terminal
tar -xzf archive.tar.gzList archive contents
Terminal
tar -tzf archive.tar.gzDownload with resume
Terminal
curl -C - -O <url>POST JSON with curl
Terminal
curl -X POST <url> -H "Content-Type: application/json" -d '{"key":"value"}'Show only HTTP status
Terminal
curl -s -o /dev/null -w "%{http_code}\n" <url>Measure request timing
Terminal
curl -s -o /dev/null -w "dns:%{time_namelookup} connect:%{time_connect} total:%{time_total}\n" <url>Mirror a site section
Terminal
wget -r -np -k <url>Edit crontab
Terminal
crontab -eList cron jobs
Terminal
crontab -lRestart a systemd service
Terminal
sudo systemctl restart <service>Linux
Service status
Terminal
systemctl status <service>Linux
Follow service logs
Terminal
journalctl -u <service> -fLinux
Enable service on boot
Terminal
sudo systemctl enable --now <service>Linux
Change file owner
Terminal
sudo chown -R <user>:<group> <path>Make a script executable
Terminal
chmod +x <script>.shCreate a symlink
Terminal
ln -s <target> <linkname>Show environment variable
Terminal
printenv <NAME>Load .env into shell
Terminal
set -a && source .env && set +aDiff two directories
Terminal
diff -rq <dir-a> <dir-b>Sort and dedupe a file
Terminal
sort <file> | uniq -c | sort -rnSplit a large file
Terminal
split -l 100000 <file> chunk_Copy output to clipboard (macOS)
Terminal
<command> | pbcopymacOS
Copy output to clipboard (Linux)
Terminal
<command> | xclip -selection clipboardLinux
Enable corepack
npm/yarn
Use the package manager version pinned in package.json.
corepack enablePin package manager
npm/yarn
corepack use pnpm@latestClean install from lockfile
npm/yarn
npm ciAudit and fix vulnerabilities
npm/yarn
npm audit fixAudit production only
npm/yarn
npm audit --omit=devList outdated packages
npm/yarn
npm outdatedUpdate to latest majors
npm/yarn
npx npm-check-updates -u && npm installWhy is a package installed
npm/yarn
npm explain <package>Dependency tree depth 0
npm/yarn
npm ls --depth=0Run script in all workspaces
npm/yarn
npm run <script> --workspaces --if-presentInstall into one workspace
npm/yarn
npm install <package> -w <workspace>pnpm install frozen lockfile
npm/yarn
pnpm install --frozen-lockfilepnpm run in all packages
npm/yarn
pnpm -r run buildpnpm filter a package
npm/yarn
pnpm --filter <package> devpnpm add to workspace root
npm/yarn
pnpm add -w -D <package>pnpm dedupe
npm/yarn
pnpm dedupepnpm prune store
npm/yarn
pnpm store prunebun install
npm/yarn
bun installbun add dev dependency
npm/yarn
bun add -d <package>bun run a script
npm/yarn
bun run <script>bun run a file
npm/yarn
bun <file>.tsbunx a package
npm/yarn
bunx <package>bun test
npm/yarn
bun testyarn install immutable
npm/yarn
yarn install --immutableyarn workspace command
npm/yarn
yarn workspace <name> <script>yarn upgrade interactive
npm/yarn
yarn upgrade-interactivePublish a package
npm/yarn
npm publish --access publicPublish a prerelease tag
npm/yarn
npm publish --tag nextBump version and tag
npm/yarn
npm version minor -m "release %s"Dry-run a publish
npm/yarn
npm publish --dry-runPack a tarball
npm/yarn
npm packLink a local package
npm/yarn
npm link <package>Deprecate a version
npm/yarn
npm deprecate <package>@<version> "<message>"Set npm registry
npm/yarn
npm config set registry <url>Login to npm registry
npm/yarn
npm loginClear npm cache
npm/yarn
npm cache clean --forceDestructive
Install exact version
npm/yarn
npm install <package>@<version> --save-exactReinstall node_modules
npm/yarn
rm -rf node_modules package-lock.json && npm installDestructive
Install and use Node LTS
Node.js
nvm install --lts && nvm use --ltsUse project Node version
Node.js
nvm useSet default Node version
Node.js
nvm alias default 20Run a TS file directly
Node.js
npx tsx <file>.tsTypecheck without emitting
Node.js
npx tsc --noEmitLint and autofix
Node.js
npx eslint . --fixFormat with Prettier
Node.js
npx prettier --write .Debug Node with inspector
Node.js
node --inspect-brk <file>.jsHeap snapshot on OOM
Node.js
node --heap-prof <file>.jsRaise Node memory limit
Node.js
NODE_OPTIONS=--max-old-space-size=4096 npm run buildAnalyze Vite bundle
Frontend
npx vite-bundle-visualizerPreview a production build
Frontend
npm run build && npm run previewRun Playwright tests
Frontend
npx playwright testPlaywright UI mode
Frontend
npx playwright test --uiRun Vitest once
Frontend
npx vitest runVitest coverage
Frontend
npx vitest run --coverageLighthouse audit
Performance
npx lighthouse <url> --viewCheck bundle size limits
Performance
npx size-limitBuild with buildx
Docker
docker buildx build -t <image>:<tag> .Multi-platform build and push
Docker
docker buildx build --platform linux/amd64,linux/arm64 -t <image>:<tag> --push .Create a buildx builder
Docker
docker buildx create --use --name builderBuild with no cache
Docker
docker build --no-cache -t <image>:<tag> .Build a specific stage
Docker
docker build --target builder -t <image>:dev .Pass build args
Docker
docker build --build-arg NODE_ENV=production -t <image>:<tag> .Tag an image
Docker
docker tag <image>:<tag> <registry>/<image>:<tag>Push an image
Docker
docker push <registry>/<image>:<tag>Login to a registry
Docker
docker login <registry>Inspect image layers
Docker
docker history <image>:<tag>Inspect image config
Docker
docker inspect <image>:<tag>Check container health
Docker
docker inspect --format='{{.State.Health.Status}}' <container>Container resource usage
Docker
docker stats --no-streamFollow container logs
Docker
docker logs -f --tail 100 <container>Shell into a container
Docker
docker exec -it <container> shRun a throwaway container
Docker
docker run --rm -it <image> shMount current dir into container
Docker
docker run --rm -v "$PWD":/app -w /app <image> <command>Publish a port
Docker
docker run -p 8080:80 -d <image>Pass env file to container
Docker
docker run --env-file .env -d <image>Copy file out of a container
Docker
docker cp <container>:/path/file ./fileCommit a container to an image
Docker
docker commit <container> <image>:<tag>Save an image to a tar
Docker
docker save -o image.tar <image>:<tag>Load an image from tar
Docker
docker load -i image.tarPrune dangling images
Docker
docker image pruneDestructive
Prune everything unused
Docker
Removes stopped containers, unused images and volumes.
docker system prune -a --volumesDestructive
Show docker disk usage
Docker
docker system dfList volumes
Docker
docker volume lsInspect a volume
Docker
docker volume inspect <volume>Backup a volume
Docker
docker run --rm -v <volume>:/data -v "$PWD":/backup alpine tar czf /backup/volume.tar.gz /dataList networks
Docker
docker network lsConnect container to network
Docker
docker network connect <network> <container>Compose up detached
Docker
docker compose up -dCompose up and rebuild
Docker
docker compose up -d --buildCompose down with volumes
Docker
docker compose down -vDestructive
Compose logs for a service
Docker
docker compose logs -f <service>Compose exec into a service
Docker
docker compose exec <service> shCompose run one-off command
Docker
docker compose run --rm <service> <command>Compose restart a service
Docker
docker compose restart <service>Compose scale a service
Docker
docker compose up -d --scale <service>=3Validate compose config
Docker
docker compose configCompose with override file
Docker
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -dScan an image for CVEs
Security
docker scout cves <image>:<tag>Trivy image scan
Security
trivy image <image>:<tag>Scan dependencies for CVEs
Security
npx audit-ci --moderateScan repo for secrets
Security
npx secretlint "**/*"gitleaks secret scan
Security
gitleaks detect --source . --verboseRun a model with Ollama
AI
ollama run <model>Pull an Ollama model
AI
ollama pull <model>List local Ollama models
AI
ollama listRemove an Ollama model
AI
ollama rm <model>Destructive
Serve Ollama API
AI
ollama serveCall Ollama chat API
AI
curl http://localhost:11434/api/chat -d '{"model":"<model>","messages":[{"role":"user","content":"hi"}]}'Create model from Modelfile
AI
ollama create <name> -f ModelfileShow Ollama model details
AI
ollama show <model> --modelfileDownload a Hugging Face model
AI
huggingface-cli download <repo-id> --local-dir ./models/<name>Login to Hugging Face
AI
huggingface-cli loginUpload to Hugging Face
AI
huggingface-cli upload <repo-id> ./local-dirServe a model with vLLM
AI
python -m vllm.entrypoints.openai.api_server --model <model>Quantize with llama.cpp
AI
./llama-quantize model-f16.gguf model-q4_k_m.gguf q4_k_mRun llama.cpp server
AI
./llama-server -m ./models/<model>.gguf -c 8192Check GPU utilization
AI
nvidia-smiWatch GPU utilization
AI
watch -n 1 nvidia-smiVerify CUDA in PyTorch
AI
python -c "import torch; print(torch.cuda.is_available(), torch.cuda.device_count())"Pick a GPU device
AI
CUDA_VISIBLE_DEVICES=0 python train.pyCreate a Python venv
Python
python -m venv .venv && source .venv/bin/activateFreeze Python requirements
Python
pip freeze > requirements.txtInstall from requirements
Python
pip install -r requirements.txtCreate uv project
Python
uv init && uv add <package>Run with uv
Python
uv run python <file>.pyCreate a conda env
Python
conda create -n <name> python=3.11 -yActivate a conda env
Python
conda activate <name>Export conda env
Python
conda env export > environment.ymlFormat Python with ruff
Python
ruff format .Lint Python with ruff
Python
ruff check . --fixRun pytest verbosely
Python
pytest -v -x