[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"home-cheatsheets-en":3},{"git":4,"svn":162,"linux-shell":306,"powershell":512,"cmd":689,"docker":890,"kubectl":1124,"postgresql":1331,"mysql":1513,"redis":1694,"mongodb":1904,"pnpm":2055,"ssh":2218,"curl":2354,"vim":2516},{"title":5,"description":6,"commands":7},"Git Commands Cheat Sheet","Quick reference for the most useful Git commands: init, clone, branch, merge, rebase, reset, stash, remote operations and history inspection, with common options and practical examples.",[8,13,18,22,28,33,38,43,47,53,57,62,67,72,77,82,87,93,97,102,107,113,117,122,126,132,137,143,147,153,158],{"section":9,"command":10,"description":11,"example":12},"Getting Started","git init","Create a new Git repository in the current directory.","git init my-project",{"section":9,"command":14,"description":15,"options":16,"example":17},"git clone \u003Curl>","Copy a remote repository to your local machine, including full history.","--depth 1 shallow clone (latest commit only); -b \u003Cbranch> clone a specific branch","git clone -b main --depth 1 https:\u002F\u002Fgithub.com\u002Fuser\u002Frepo.git",{"section":9,"command":19,"description":20,"example":21},"git config","Set user name, email and other options; --global applies to all repositories.","git config --global user.name \"Your Name\" && git config --global user.email \"you@example.com\"",{"section":23,"command":24,"description":25,"options":26,"example":27},"Everyday Work","git status","Show working tree state: modified, staged and untracked files.","-s short format; -b show branch info","git status -sb",{"section":23,"command":29,"description":30,"options":31,"example":32},"git add \u003Cfile>","Stage file changes for the next commit.","-A stage all changes; -p interactively pick hunks; -u stage tracked files only","git add -p src\u002Findex.ts",{"section":23,"command":34,"description":35,"options":36,"example":37},"git commit","Record staged changes with a message.","-m message inline; -a stage tracked files and commit; --amend rewrite the last commit","git commit -am \"fix: handle empty input\"",{"section":23,"command":39,"description":40,"options":41,"example":42},"git diff","Show line-level changes between working tree, index and commits.","--staged staged vs last commit; \u003Cbranch> compare with a branch; --stat summary only","git diff --staged --stat",{"section":23,"command":44,"description":45,"example":46},"git restore \u003Cfile>","Discard uncommitted changes in the working tree (or unstage with --staged).","git restore --staged src\u002Findex.ts",{"section":48,"command":49,"description":50,"options":51,"example":52},"Branching","git branch","List, create or delete branches.","-d delete; -D force delete; -m rename; -a list remote branches too","git branch -m old-name new-name",{"section":48,"command":54,"description":55,"example":56},"git switch \u003Cbranch>","Switch to another branch; -c creates it first (modern replacement for checkout).","git switch -c feature\u002Flogin",{"section":48,"command":58,"description":59,"options":60,"example":61},"git merge \u003Cbranch>","Merge another branch into the current one.","--no-ff always create a merge commit; --abort cancel a conflicted merge","git merge --no-ff feature\u002Flogin",{"section":48,"command":63,"description":64,"options":65,"example":66},"git rebase \u003Cbranch>","Replay your commits on top of another branch for a linear history.","-i interactive (squash\u002Freword\u002Freorder); --abort cancel; --continue after resolving","git rebase -i HEAD~3",{"section":68,"command":69,"description":70,"example":71},"Remote","git remote -v","List configured remote repositories with URLs.","git remote add origin https:\u002F\u002Fgithub.com\u002Fuser\u002Frepo.git",{"section":68,"command":73,"description":74,"options":75,"example":76},"git fetch","Download objects and refs from the remote without merging.","--prune delete stale remote-tracking branches; --all fetch all remotes","git fetch --prune origin",{"section":68,"command":78,"description":79,"options":80,"example":81},"git pull","Fetch from the remote and merge (or rebase) into the current branch.","--rebase rebase instead of merge; --ff-only fast-forward only","git pull --rebase origin main",{"section":68,"command":83,"description":84,"options":85,"example":86},"git push","Upload local commits to the remote repository.","-u set upstream tracking; --force-with-lease safer force push; --tags push tags","git push -u origin feature\u002Flogin",{"section":88,"command":89,"description":90,"options":91,"example":92},"Undo & Fix","git reset","Move HEAD to another commit, optionally changing index and working tree.","--soft keep changes staged; --mixed (default) keep changes unstaged; --hard discard everything","git reset --hard HEAD~1",{"section":88,"command":94,"description":95,"example":96},"git revert \u003Ccommit>","Create a new commit that undoes a previous commit. Safe for shared history.","git revert HEAD",{"section":88,"command":98,"description":99,"options":100,"example":101},"git commit --amend","Rewrite the most recent commit: fix its message or add forgotten changes.","--no-edit keep the original message","git commit --amend --no-edit",{"section":88,"command":103,"description":104,"options":105,"example":106},"git clean","Remove untracked files from the working tree.","-n dry run; -f force; -d include directories; -x include ignored files","git clean -ndx",{"section":108,"command":109,"description":110,"options":111,"example":112},"History & Inspect","git log","Show commit history.","--oneline one line per commit; --graph branch graph; -p show diffs; -n limit count","git log --oneline --graph -15",{"section":108,"command":114,"description":115,"example":116},"git show \u003Ccommit>","Show a commit's message and diff; also works for tags and files (git show HEAD:file).","git show HEAD~2 --stat",{"section":108,"command":118,"description":119,"options":120,"example":121},"git blame \u003Cfile>","Show who last modified each line of a file and in which commit.","-L n,m restrict to a line range","git blame -L 10,20 src\u002Findex.ts",{"section":108,"command":123,"description":124,"example":125},"git reflog","Show the history of HEAD movements — recover lost commits after a bad reset or rebase.","git reflog -20",{"section":127,"command":128,"description":129,"options":130,"example":131},"Stash","git stash","Temporarily shelve uncommitted changes and clean the working tree.","-u include untracked files; push -m message; list show all stashes","git stash push -u -m \"wip: login form\"",{"section":127,"command":133,"description":134,"options":135,"example":136},"git stash pop","Re-apply the most recent stash and remove it from the stash list.","apply re-apply but keep the stash entry","git stash apply stash@{1}",{"section":138,"command":139,"description":140,"options":141,"example":142},"Tags & Release","git tag","List, create or delete tags marking release points.","-a annotated tag; -m message; -d delete","git tag -a v1.2.0 -m \"Release 1.2.0\"",{"section":138,"command":144,"description":145,"example":146},"git describe --tags","Show the most recent tag reachable from the current commit, plus distance.","git describe --tags --always",{"section":148,"command":149,"description":150,"options":151,"example":152},"Advanced","git cherry-pick \u003Ccommit>","Apply the changes of a specific commit onto the current branch.","-n apply without committing; -x append source commit hash to message","git cherry-pick -x a1b2c3d",{"section":148,"command":154,"description":155,"options":156,"example":157},"git bisect","Binary-search the history to find the commit that introduced a bug.","start \u002F bad \u002F good \u002F run \u003Ccmd> \u002F reset","git bisect start && git bisect bad && git bisect good v1.0.0",{"section":148,"command":159,"description":160,"example":161},"git worktree add \u003Cpath> \u003Cbranch>","Check out another branch into a separate directory sharing the same repository.","git worktree add ..\u002Fhotfix hotfix\u002Furgent-bug",{"title":163,"description":164,"commands":165},"SVN Commands Cheat Sheet","Quick reference for Subversion (SVN) commands: checkout, update, commit, branch\u002Ftag, merge, history inspection and repository administration, with common options and practical examples.",[166,171,175,180,185,190,195,200,205,210,216,221,226,232,236,241,246,251,255,261,265,270,275,281,286,291,296,301],{"section":9,"command":167,"description":168,"options":169,"example":170},"svn checkout \u003Curl> [\u003Cdir>]","Check out a working copy from a repository; the first time you fetch project files.","-r \u003Crev> specific revision; --depth empty|files|immediates|infinity","svn checkout https:\u002F\u002Fsvn.example.com\u002Frepo\u002Ftrunk .\u002Fmy-project",{"section":9,"command":172,"description":173,"example":174},"svn info","Show working copy or URL info: URL, revision, last-modified, etc.","svn info .",{"section":23,"command":176,"description":177,"options":178,"example":179},"svn update","Bring your working copy in sync with the repository; may merge server changes.","-r \u003Crev> update to a specific revision; --accept postpone|base|mine-full|theirs-full|edit|launch","svn update --accept postpone",{"section":23,"command":181,"description":182,"options":183,"example":184},"svn status","Show working copy status: modifications, additions, deletions, untracked files.","-u show server out-of-date info; -v verbose; --quiet suppress untracked","svn status -u",{"section":23,"command":186,"description":187,"options":188,"example":189},"svn add \u003Cpath>","Schedule a file or directory to be added on the next commit.","-N non-recursive (directory only); --force add already-versioned","svn add src\u002Futils\u002F helpers\u002F",{"section":23,"command":191,"description":192,"options":193,"example":194},"svn delete \u003Cpath>","Remove a file or directory from the working copy and schedule deletion on the next commit.","--keep-local keep the file in working copy (no removal on server)","svn delete obsolete\u002Fold-config.json",{"section":23,"command":196,"description":197,"options":198,"example":199},"svn commit -m \"\u003Cmsg>\"","Send local changes to the repository with a log message.","-m inline message; -F \u003Cfile> read message from file; --no-unlock keep locks","svn commit -m \"feat: add login form validation\"",{"section":23,"command":201,"description":202,"options":203,"example":204},"svn diff","Show unified diff between paths or revisions.","-r \u003Crev1>:\u003Crev2> compare revisions; -c \u003Crev> changes made in a revision; --diff-cmd \u002F -x","svn diff -r HEAD~5:HEAD --summarize",{"section":23,"command":206,"description":207,"options":208,"example":209},"svn revert \u003Cpath>","Discard local edits and restore the file\u002Fdirectory to its pristine state.","-R recursive; --depth infinite","svn revert -R .",{"section":211,"command":212,"description":213,"options":214,"example":215},"Branching & Tags","svn copy \u003Csrc> \u003Cdst>","Create a branch or tag by copying in the repository (cheap copy).","-r \u003Crev> copy from a specific revision; -m message","svn copy ^\u002Ftrunk ^\u002Fbranches\u002Ffeature-x -m \"branch: feature-x\"",{"section":211,"command":217,"description":218,"options":219,"example":220},"svn switch \u003Curl>","Switch the working copy to point at a different branch\u002Ftag without re-checking out.","-r \u003Crev> switch to a specific revision; --relocate rewrite URL prefix","svn switch ^\u002Fbranches\u002Ffeature-x",{"section":211,"command":222,"description":223,"options":224,"example":225},"svn list \u003Curl>","List entries in a repository directory without checking them out.","-v verbose; -r \u003Crev>","svn list -v ^\u002Ftags\u002F",{"section":227,"command":228,"description":229,"options":230,"example":231},"Merging & Conflict","svn merge \u003Curl[@rev]>","Apply the differences between two sources\u002Fbranches into your working copy.","-c \u003Crev> \u002F -r \u003Crev1>:\u003Crev2> revisions to merge; --record-only merge tracking only","svn merge ^\u002Ftrunk -c 12345",{"section":227,"command":233,"description":234,"example":235},"svn merge --reintegrate \u003Curl>","Reintegrate a feature branch back into its source branch (legacy, pre-1.8).","svn merge --reintegrate ^\u002Fbranches\u002Ffeature-x",{"section":227,"command":237,"description":238,"options":239,"example":240},"svn resolve \u003Cpath>","Resolve conflicted files after a merge\u002Fupdate.","--accept base|mine-full|theirs-full|working|theirs-conflict|theirs-full","svn resolve --accept theirs-full conflict.txt",{"section":108,"command":242,"description":243,"options":244,"example":245},"svn log","Show commit log messages for files or the repository.","-r \u003Crev1>:\u003Crev2> range; -l \u003Cn> limit; -v verbose paths; --xml","svn log -l 20 -v",{"section":108,"command":247,"description":248,"options":249,"example":250},"svn blame \u003Cfile>","Show the author and revision for each line in a file (praise \u002F annotate).","-r \u003Crev> annotate as of revision; -v include revision text","svn blame src\u002Findex.ts | tail -20",{"section":108,"command":252,"description":253,"example":254},"svn cat \u003Curl>[@rev]","Show the contents of a file at a given URL\u002Frevision without checking it out.","svn cat ^\u002Ftrunk\u002FREADME.md@HEAD",{"section":256,"command":257,"description":258,"options":259,"example":260},"Properties & Locks","svn propset \u003Cprop> \u003Cvalue> \u003Cpath>","Set a property on a file or directory (e.g., svn:ignore, svn:executable, svn:mime-type).","-F \u003Cfile> value from file; --revprop repository revprop","svn propset svn:ignore \"node_modules\\n.DS_Store\" .",{"section":256,"command":262,"description":263,"example":264},"svn propedit \u003Cprop> \u003Cpath>","Open the property value in an editor to change it.","svn propedit svn:ignore .",{"section":256,"command":266,"description":267,"options":268,"example":269},"svn lock \u003Ctarget>","Lock files so no other client can commit changes (requires server config).","-m \"reason\"; --force steal lock","svn lock images\u002Fbanner.png -m \"editing before release\"",{"section":256,"command":271,"description":272,"options":273,"example":274},"svn unlock \u003Ctarget>","Release a lock on a file or directory.","--force break another's lock","svn unlock images\u002Fbanner.png",{"section":276,"command":277,"description":278,"options":279,"example":280},"Repository & Cleanup","svn cleanup","Clean up the working copy: remove lock tokens, fix timestamp, complete pending ops.","--diff3-cmd \u002F --remove-unversioned untracked cleanup","svn cleanup \u002Fpath\u002Fto\u002Fwc",{"section":276,"command":282,"description":283,"options":284,"example":285},"svn export \u003Curl> [\u003Cdir>]","Export a clean directory tree (without .svn metadata) — useful for packaging.","-r \u003Crev> specific revision; --force overwrite existing","svn export ^\u002Ftags\u002Fv1.2.0 .\u002Frelease-1.2",{"section":276,"command":287,"description":288,"options":289,"example":290},"svn import \u003Cpath> \u003Curl> -m \"\u003Cmsg>\"","Add an unversioned tree to the repository as a single initial commit.","--no-ignore include ignored files; --auto-props apply auto-props","svn import .\u002Fsrc ^\u002Ftrunk -m \"initial import\"",{"section":276,"command":292,"description":293,"options":294,"example":295},"svn relocate \u003Cfrom-prefix> \u003Cto-prefix>","Rewrite the repository URL prefix stored in the working copy (server moved).","--strict reject non-matching prefix","svn relocate https:\u002F\u002Fold.svn.example.com https:\u002F\u002Fnew.svn.example.com",{"section":297,"command":298,"description":299,"example":300},"Patch","svn diff > patch.diff","Produce a unified diff suitable for sharing or applying with svn patch.","svn diff > \u002Ftmp\u002Ffeature-x.patch",{"section":297,"command":302,"description":303,"options":304,"example":305},"svn patch \u003Cpatch-file>","Apply a unified diff generated by svn diff to the working copy.","--dry-run preview; --reverse-cmd","svn patch --dry-run \u002Ftmp\u002Ffeature-x.patch",{"title":307,"description":308,"commands":309},"Linux Shell Commands Cheat Sheet","Quick reference for everyday Linux \u002F macOS shell commands: file operations, text processing, permissions, processes, networking, archive and storage — with common options and practical examples.",[310,314,319,323,328,334,339,344,349,354,358,364,369,373,378,384,389,394,399,403,409,414,419,425,430,435,439,444,450,455,460,465,471,476,481,487,492,498,502,506],{"section":311,"command":312,"description":313,"example":312},"Files & Navigation","pwd","Print the absolute path of the current working directory.",{"section":311,"command":315,"description":316,"options":317,"example":318},"ls","List directory contents.","-l long format; -a include hidden; -h human sizes; -t sort by mtime; -r reverse","ls -lah \u002Fvar\u002Flog",{"section":311,"command":320,"description":321,"example":322},"cd \u003Cdir>","Change the current working directory.","cd ~\u002F-projects\u002Fapp && pwd",{"section":311,"command":324,"description":325,"options":326,"example":327},"tree \u003Cdir>","Recursively list a directory as a tree; great for overview (may need install).","-L \u003Cn> max depth; -a show hidden; -d dirs only; -I pattern","tree -L 2 -I 'node_modules|.git' .",{"section":329,"command":330,"description":331,"options":332,"example":333},"File Operations","mkdir -p \u003Cdir>","Create a directory (and any missing parents) in one shot.","-p create parents; -v verbose; -m \u003Cmode> set permissions","mkdir -p src\u002Fcomponents\u002Fui",{"section":329,"command":335,"description":336,"options":337,"example":338},"cp \u003Csrc> \u003Cdest>","Copy files or directories.","-r recursive (for dirs); -i interactive; -v verbose; -p preserve mode\u002Ftime","cp -rv src\u002F backup\u002F",{"section":329,"command":340,"description":341,"options":342,"example":343},"mv \u003Csrc> \u003Cdest>","Move (rename) files or directories.","-i interactive; -v verbose; -n no-overwrite","mv README.md readme.md && mv ..\u002Ftmp .",{"section":329,"command":345,"description":346,"options":347,"example":348},"rm \u003Cpath>","Remove files or directories. ⚠️ there is no trash — double-check paths.","-r recursive; -f force; -i interactive; -v verbose","rm -rf build\u002F node_modules\u002F",{"section":329,"command":350,"description":351,"options":352,"example":353},"ln -s \u003Ctarget> \u003Clink>","Create a symbolic link at \u003Clink> pointing to \u003Ctarget>.","-s symbolic (default: hard); -f overwrite existing; -n do not follow existing","ln -s \u002Fopt\u002Fapp-v2 current",{"section":329,"command":355,"description":356,"example":357},"touch \u003Cfile>","Create an empty file or update its mtime without changing contents.","touch .gitignore",{"section":359,"command":360,"description":361,"options":362,"example":363},"Text & Viewing","cat \u003Cfile>","Print the entire contents of a file to stdout.","-n number lines; -A show non-printing chars; -s squeeze blanks","cat -n package.json",{"section":359,"command":365,"description":366,"options":367,"example":368},"less \u003Cfile>","Open a file in a paginator (use \u002F, n, N to search; q to quit).","-N line numbers; -S no wrap; +F auto-follow tail-like","less -NS \u002Fvar\u002Flog\u002Fsyslog",{"section":359,"command":370,"description":371,"example":372},"head -n 10 \u003Cfile>","Output the first N lines (default 10) of a file.","head -n 30 \u002Fetc\u002Fpasswd",{"section":359,"command":374,"description":375,"options":376,"example":377},"tail -n 50 -f \u003Cfile>","Show the last N lines and follow the file as it grows (for logs).","-f follow; -F follow & retry; -n lines (default 10); -c bytes; --pid=PID stop when PID dies","tail -f -n 50 \u002Fvar\u002Flog\u002Fnginx\u002Faccess.log",{"section":379,"command":380,"description":381,"options":382,"example":383},"Search & Filter","grep \u003Cpattern> \u003Cfiles>","Search lines matching a pattern; supports extended and PCRE regex.","-i case-insensitive; -r recursive; -n line numbers; -v invert; -E extended regex","grep -rni \"TODO\" src\u002F",{"section":379,"command":385,"description":386,"options":387,"example":388},"find \u003Cpath> -name \u003Cpattern>","Walk a directory tree and list files matching criteria.","-type f|d; -name glob; -iname case-insensitive; -size +1M; -mtime -7; -maxdepth","find . -type f -name \"*.log\" -mtime +7 -delete",{"section":379,"command":390,"description":391,"options":392,"example":393},"awk '\u003Cprog>' \u003Cfile>","Pattern-action text scanner — slicing columns, summing values, etc.","-F fs field separator; -v var=value; -f script file","awk -F'\\t' 'NR>1 {sum+=$3} END {print sum}' data.tsv",{"section":379,"command":395,"description":396,"options":397,"example":398},"sed 's\u002F\u003Ca>\u002F\u003Cb>\u002F' \u003Cfile>","Stream editor — substitution, deletion, insertion per-line.","-i edit in place; -E extended regex; -e combine exprs; s\u002Ffrom\u002Fto\u002F[g] [p]","sed -i '' 's\u002Fversion = \"1\\..\"\u002Fversion = \"1.9\"\u002F' pyproject.toml",{"section":379,"command":400,"description":401,"example":402},"sort | uniq -c | sort -nr","Pipeline idiom: count occurrences and sort by frequency descending.","awk '{print $1}' access.log | sort | uniq -c | sort -nr | head",{"section":404,"command":405,"description":406,"options":407,"example":408},"Permissions","chmod \u003Cmode> \u003Cfile>","Change file permissions (e.g., 755, u+x, g-w, o=r).","-R recursive; --reference=\u003Cfile> copy mode","chmod -R u=rwX,go=r .\u002Fdocs",{"section":404,"command":410,"description":411,"options":412,"example":413},"chown \u003Cuser>[:\u003Cgroup>] \u003Cfile>","Change file owner and group.","-R recursive; -h affect symlinks (with -R)","chown -R www-data:www-data \u002Fvar\u002Fwww\u002Fhtml",{"section":404,"command":415,"description":416,"options":417,"example":418},"umask","Show\u002Fset the default permission mask for newly created files.","-S symbolic; -p umask preserved for portability","umask 022",{"section":420,"command":421,"description":422,"options":423,"example":424},"Processes & System","ps aux","Show all processes with detailed info (BSD-style columns).","-e all; -f full; -L threads; --sort=-%mem","ps auxf | grep -v grep | grep nginx",{"section":420,"command":426,"description":427,"options":428,"example":429},"top \u002F htop","Live, interactive process viewer (htop has nicer UI; may need install).","P\u002FCPU M\u002FMEM sort; k kill; r renice; q quit","htop -u www-data",{"section":420,"command":431,"description":432,"options":433,"example":434},"kill [-9|\u003Csig>] \u003Cpid>","Send a signal to a process. SIGTERM (15) is polite; SIGKILL (9) is forceful.","-9 SIGKILL; -l list signals; -s specify signal by name","kill -TERM 12345 && sleep 2 && kill -9 12345",{"section":420,"command":436,"description":437,"example":438},"jobs \u002F bg \u002F fg \u002F nohup","Manage job control — list, background, foreground, run immune to hangups.","nohup .\u002Flong-task.sh > out.log 2>&1 &",{"section":420,"command":440,"description":441,"options":442,"example":443},"systemctl \u003Cverb> \u003Cunit>","Control systemd services and units (status, start, stop, enable, logs).","status \u002F start \u002F stop \u002F restart \u002F enable \u002F disable; -u \u003Cuser>","systemctl status nginx && systemctl reload nginx",{"section":445,"command":446,"description":447,"options":448,"example":449},"Network","wget \u003Curl>","Non-interactive downloader; recursive \u002F mirror friendly.","-c continue; -q quiet; --no-check-certificate; -r recursive","wget -c https:\u002F\u002Fexample.com\u002Fbig-archive.tar.gz",{"section":445,"command":451,"description":452,"options":453,"example":454},"ssh \u003Cuser>@\u003Chost> [cmd]","Open an SSH session or run a one-off command on a remote host.","-p \u003Cport>; -i \u003Ckey>; -L \u002F -R \u002F -D port forwardings; -N no remote cmd; -f background","ssh -i ~\u002F.ssh\u002Fid_ed25519 user@host 'sudo systemctl restart nginx'",{"section":445,"command":456,"description":457,"options":458,"example":459},"scp \u002F rsync","Copy files to\u002Ffrom a remote host. rsync is faster for partial \u002F repeated transfers.","scp -r \u002F rsync -avz --progress src\u002F user@host:\u002Fdst\u002F","rsync -avz --progress .\u002Fbuild\u002F deploy@server:\u002Fsrv\u002Fapp\u002F",{"section":445,"command":461,"description":462,"options":463,"example":464},"ping \u002F traceroute \u002F ss","Diagnose reachability, path and listening sockets.","ping -c N count; ss -tulnp listen info; ss -s summary","ss -tulnp | grep -E ':80|:443'",{"section":466,"command":467,"description":468,"options":469,"example":470},"Archive & Compress","tar -czf out.tgz \u003Cpaths>","Create or extract tar archives, optionally with gzip\u002Fbzip2\u002Fxz.","-c create; -x extract; -t list; -z gzip; -j bzip2; -J xz; -v verbose; -C \u003Cdir>","tar -czf - src\u002F | ssh server 'tar -xzf - -C \u002Fsrv\u002Fapp'",{"section":466,"command":472,"description":473,"options":474,"example":475},"zip -r out.zip \u003Cpaths>","Create a zip archive recursively.","-r recurse; -9 max compression; -e encrypt; -j junk paths","zip -r9 build-$(date +%Y%m%d).zip dist\u002F",{"section":466,"command":477,"description":478,"options":479,"example":480},"unzip [-d \u003Cdir>] file.zip","Extract a zip archive, optionally to a target directory.","-d target dir; -o overwrite; -l list; -p to stdout; -q quiet","unzip -o build.zip -d .\u002Fextracted",{"section":482,"command":483,"description":484,"options":485,"example":486},"Disk & Storage","df -h","Show mounted filesystem disk space usage, human-readable.","-h human; -T print filesystem type; -i inodes","df -hT \u002F",{"section":482,"command":488,"description":489,"options":490,"example":491},"du -sh \u003Cpath>","Estimate file space usage; -s summarizes a directory.","-s summarize; -h human; -a all; --max-depth=N; -x stay on one fs","du -sh node_modules\u002F build\u002F .",{"section":493,"command":494,"description":495,"options":496,"example":497},"Shell Built-ins","history \u002F !! \u002F !$","Browse, replay and re-use previous commands.","history N; !\u003Cn> rerun line N; !$ = last arg of last command; !! rerun last","git add . && git commit -m \"$(!!)\"",{"section":493,"command":499,"description":500,"example":501},"alias \u002F unalias","Define or list shell command shortcuts (often in ~\u002F.bashrc \u002F ~\u002F.zshrc).","alias ll='ls -lah' && alias gs='git status'",{"section":493,"command":503,"description":504,"example":505},"env \u002F export \u002F unset","List, set and clear environment variables for child processes.","export DATABASE_URL=postgres:\u002F\u002Flocalhost\u002Fdev && env | grep DATABASE",{"section":507,"command":508,"description":509,"options":510,"example":511},"Help","man \u003Ccmd> \u002F \u003Ccmd> --help","Read the manual page (man) or built-in help for a command.","man -k keyword search; man -t \u003Ccmd> print to PDF; --help short usage","man -k 'tar archive'",{"title":513,"description":514,"commands":515},"PowerShell Commands Cheat Sheet","Quick reference for PowerShell cmdlets: discovery, file\u002Fsystem, pipeline filtering and selection, networking, remote sessions and modules — with common parameters and practical examples.",[516,522,527,532,537,542,547,552,557,562,567,573,578,583,588,593,598,604,608,614,619,623,627,633,638,644,649,654,660,665,669,675,680,685],{"section":517,"command":518,"description":519,"options":520,"example":521},"Discovery & Help","Get-Command [\u003Cname>]","Discover commands by name, alias, or wildcard — really the 'man' of PowerShell.","-Module \u003Cmodule>; -Noun \u002F -Verb; -ParameterType; -All","Get-Command -Noun Service | Format-Table Name, Module",{"section":517,"command":523,"description":524,"options":525,"example":526},"Get-Help \u003Ccmdlet> [-Examples|-Detailed|-Full]","Show help for a cmdlet: synopsis, syntax, parameters, examples.","-Examples; -Detailed; -Full; -Online open browser; -ShowWindow GUI","Get-Help Get-Process -Examples",{"section":517,"command":528,"description":529,"options":530,"example":531},"Get-Module [-ListAvailable]","List modules loaded into the session (or available for import).","-ListAvailable; -All; -Name filter","Get-Module -ListAvailable | Sort-Object Name",{"section":533,"command":534,"description":535,"example":536},"Navigation & FS","Set-Location \u002F Get-Location \u002F pwd","Change or print the current working directory.","Set-Location C:\\projects\\app; Get-Location",{"section":533,"command":538,"description":539,"options":540,"example":541},"Get-ChildItem (alias ls\u002Fdir)","List files and subdirectories (recursively with -Recurse).","-Recurse; -Force hidden; -Filter \u003Cpattern>; -File \u002F -Directory; -Depth","Get-ChildItem -Recurse -File -Filter *.log | Sort-Object Length -Descending | Select-Object -First 10",{"section":533,"command":543,"description":544,"options":545,"example":546},"New-Item -ItemType File\u002FDirectory \u003Cpath>","Create a new file or directory (default: file).","-Force overwrite\u002Fcreate parents; -ItemType File|Directory|SymbolicLink; -Value content","New-Item -ItemType Directory -Path logs\u002F2026 | Out-Null",{"section":533,"command":548,"description":549,"options":550,"example":551},"Remove-Item (alias rm\u002Fdel)","Delete files, directories, registry keys, or variables.","-Recurse; -Force; -Confirm:\\$false to skip prompts","Remove-Item -Recurse -Force build\u002F, node_modules\u002F",{"section":533,"command":553,"description":554,"options":555,"example":556},"Copy-Item \u002F Move-Item \u002F Rename-Item","Copy, move or rename filesystem items.","-Recurse; -Force; -To; -Exclude \u002F -Include filters","Copy-Item -Recurse dist\\* \\\\deploy\\shares\\app\\",{"section":533,"command":558,"description":559,"options":560,"example":561},"Get-Content \u002F Set-Content \u002F Add-Content","Read or write file content (Get-Content with -Tail behaves like Unix tail).","-Tail N; -Wait follow; -TotalCount N; -Encoding utf8\u002FASCII","Get-Content -Path app.log -Tail 50 -Wait",{"section":533,"command":563,"description":564,"options":565,"example":566},"Test-Path \u002F Resolve-Path","Check if a path exists (file, dir, registry) or resolve wildcards.","-PathType Container|Leaf; -IsValid","if (Test-Path .\\node_modules) { Remove-Item -Recurse .\\node_modules }",{"section":568,"command":569,"description":570,"options":571,"example":572},"Pipeline & Objects","Where-Object (alias ?)","Filter objects in the pipeline by a property or script block.","-Property \u002F -Value pattern match; -Like \u002F -EQ \u002F -GT ...; -CContains \u002F -In","Get-Process | Where-Object { $_.WorkingSet64 -gt 200MB }",{"section":568,"command":574,"description":575,"options":576,"example":577},"Select-Object (alias select)","Choose specific properties, deduplicate, or expand to N items.","-Property names; -First \u002F -Last N; -Skip N; -Unique; -ExpandProperty","Get-Service | Select-Object Name, Status, StartType | Format-Table",{"section":568,"command":579,"description":580,"options":581,"example":582},"ForEach-Object (alias %)","Perform an action on each object arriving in the pipeline.","-Begin \u002F -Process \u002F -End; -Parallel on PS7+","Get-ChildItem *.csv | ForEach-Object { Import-Csv $_ | Group-Object Level }",{"section":568,"command":584,"description":585,"options":586,"example":587},"Sort-Object (alias sort)","Sort pipeline objects by one or more properties.","-Property; -Descending","Get-ChildItem | Sort-Object -Property Length -Descending | Select -First 5",{"section":568,"command":589,"description":590,"options":591,"example":592},"Group-Object (alias group)","Group objects by a property value; `-NoElement` yields just counts.","-Property; -NoElement; -CaseSensitive","Get-Content app.log | Group-Object | Sort-Object Count -Descending",{"section":568,"command":594,"description":595,"options":596,"example":597},"Measure-Object (alias measure)","Compute numeric statistics (count, sum, min\u002Fmax\u002Favg) for a property.","-Sum \u002F -Average \u002F -Minimum \u002F -Maximum; -Line \u002F -Word \u002F -Character for text","Get-ChildItem -File -Recurse | Measure-Object -Property Length -Sum",{"section":599,"command":600,"description":601,"options":602,"example":603},"Formatting","Format-Table \u002F Format-List (ft \u002F fl)","Render pipeline objects as a table or a list — for display only.","-AutoSize; -Wrap; -GroupBy; -Property subset","Get-Process | Format-Table Name, Id, @{n='Mem(MB)';e={[Math]::Round($_.WorkingSet64\u002F1MB,1)}} -AutoSize",{"section":599,"command":605,"description":606,"example":607},"Out-File \u002F Set-Content \u002F Tee-Object","Write output to a file; Tee-Object writes both to a file and the pipeline.","Get-Service | Tee-Object -FilePath services.txt | Where-Object { $_.Status -eq 'Running' }",{"section":609,"command":610,"description":611,"options":612,"example":613},"Strings & Variables","Select-String (alias sls)","Grep equivalent — find lines matching a pattern (regex-aware).","-Path; -Pattern; -SimpleMatch; -CaseSensitive; -Context N","Select-String -Path src\\**\\*.ts -Pattern 'TODO' -CaseSensitive:\\$false",{"section":609,"command":615,"description":616,"options":617,"example":618},"Set-Variable (alias set\u002Fsv)","Define a session or environment variable.","-Name; -Value; -Scope Global|Local|Script; -PassThru","Set-Variable -Name regions -Value @('eastus','westus') -Scope Global",{"section":609,"command":620,"description":621,"example":622},"Get-Variable \u002F $env:","List or read variables; read\u002Fwrite process environment via $env: drive.","$env:DATABASE_URL = 'postgres:\u002F\u002Flocalhost\u002Fdev'; Get-Variable | Out-GridView",{"section":609,"command":624,"description":625,"example":626},"Get-Alias \u002F Set-Alias","List or define custom shortcuts for cmdlets.","Set-Alias -Name grep -Value Select-String -Option ReadOnly -Scope Global",{"section":628,"command":629,"description":630,"options":631,"example":632},"Processes & Services","Get-Process \u002F Start-Process \u002F Stop-Process","Inspect, start or stop local processes (Stop-Process = kill).","-Name; -Id; -FileVersionInfo; -PassThru; -Force for kill","Get-Process node | Sort-Object -Property WorkingSet64 -Descending | Select -First 5",{"section":628,"command":634,"description":635,"options":636,"example":637},"Get-Service \u002F Start-Service \u002F Stop-Service","Inspect, start or stop Windows services.","-Name; -DisplayName; -Status Running|Stopped","Get-Service | Where-Object Status -eq Stopped | Format-Table Name, StartupType",{"section":639,"command":640,"description":641,"options":642,"example":643},"Networking","Test-NetConnection \u003Chost>","Diagnose TCP connectivity, latency, and (with -Port) reachability.","-Port; -InformationLevel Detailed; -DiagnoseRouting","Test-NetConnection api.example.com -Port 443",{"section":639,"command":645,"description":646,"options":647,"example":648},"Invoke-WebRequest \u002F Invoke-RestMethod","HTTP client (RestMethod parses JSON straight into objects).","-Method GET\u002FPOST\u002FPUT\u002FDELETE; -Headers @{...}; -Body (json); -OutFile path; -SkipHttpRedirect; -UseBasicParsing","Invoke-RestMethod -Uri https:\u002F\u002Fapi.github.com\u002Frepos\u002Fpowershell\u002Fpowershell\u002Freleases\u002Flatest | Select-Object tag_name, html_url",{"section":639,"command":650,"description":651,"options":652,"example":653},"Resolve-DnsName \u002F Get-NetIPAddress","Resolve DNS records and inspect local IP configuration.","-Type A\u002FAAAA\u002FMX\u002FCNAME; -Server 8.8.8.8; -AddressFamily IPv4\u002FIPv6","Resolve-DnsName example.com -Type MX",{"section":655,"command":656,"description":657,"options":658,"example":659},"Remote & Module","Enter-PSSession \u002F Invoke-Command","Start or run a command on remote machines (WinRM \u002F SSH).","-ComputerName \u002F -HostName; -Credential; -ConfigurationName; -FilePath","Invoke-Command -ComputerName web01,web02 -FilePath .\\deploy.ps1",{"section":655,"command":661,"description":662,"options":663,"example":664},"Import-Module \u002F Find-Module \u002F Install-Module","Load a module into the session or fetch it from a repository.","-Force reload; -Scope Global\u002FCurrentUser; -AcceptLicense; -AllowClobber","Install-Module -Name Az -Scope CurrentUser -AcceptLicense",{"section":655,"command":666,"description":667,"example":668},"Get-Module \u002F Remove-Module","List loaded modules or unload one from the session.","Get-Module | Format-Table Name, Version, ExportedCommands.Count",{"section":670,"command":671,"description":672,"options":673,"example":674},"System","Get-Date \u002F Set-Date","Read or change the current date\u002Ftime with rich formatting.","-Format; -UFormat; -DisplayHint; -Culture","Get-Date -Format 'yyyy-MM-dd HH:mm:ss'",{"section":670,"command":676,"description":677,"options":678,"example":679},"Get-CimInstance Win32_OperatingSystem","Hardware\u002Fsystem info via CIM\u002FWMI (memory, disk, OS, BIOS, etc.).","-ClassName; -ComputerName; -Filter query","Get-CimInstance Win32_LogicalDisk -Filter \"DeviceID='C:'\" | Select DeviceID, @{n='FreeGB';e={[Math]::Round($_.FreeSpace\u002F1GB,2)}}",{"section":670,"command":681,"description":682,"options":683,"example":684},"Get-History \u002F Invoke-History (alias h\u002Fr)","Replay recently run commands in the current session.","-Count N; -Id N to rerun a specific entry","Get-History | Where-Object CommandLine -like 'Get-*' | Invoke-History",{"section":670,"command":686,"description":687,"example":688},"$PROFILE \u002F Update-Help","Edit your profile (startup script) and refresh cmdlet help.","notepad $PROFILE; Update-Help -Force",{"title":690,"description":691,"commands":692},"Windows CMD Commands Cheat Sheet","Quick reference for the classic Windows Command Prompt (cmd.exe): file\u002Fdir operations, text search, system info, networking and batch scripting — with common options and practical examples.",[693,698,703,707,712,717,722,727,732,737,741,746,751,756,761,766,770,775,780,785,790,795,800,805,810,815,820,825,829,834,839,844,849,854,859,865,870,875,880,885],{"section":694,"command":695,"description":696,"example":697},"Navigation & Help","cd \u002Fd \u003Cpath>","Change current directory; \u002Fd also changes the drive letter.","cd \u002Fd D:\\projects\\app",{"section":694,"command":699,"description":700,"options":701,"example":702},"dir [\u003Cpath>]","List files and subdirectories with size, date and attributes.","\u002Fa show hidden\u002Fsystem; \u002Fs recurse; \u002Fo sort by date\u002Fsize; \u002Fb bare format; \u002Fw wide","dir \u002Fa \u002Fo:-d \u002Fb C:\\logs",{"section":694,"command":704,"description":705,"example":706},"\u003Ccmd> \u002F?","Show the built-in help for any command (e.g., 'robocopy \u002F?').","xcopy \u002F?",{"section":694,"command":708,"description":709,"options":710,"example":711},"tree [\u003Cpath>]","Graphically display the folder structure of a drive or path.","\u002FF include files; \u002FA use ASCII characters; \u002FJ Juniper format","tree C:\\projects \u002FF | more",{"section":713,"command":714,"description":715,"example":716},"Files & Directories","md \u003Cdir>  (or mkdir)","Create one or more directories.","md C:\\app\\logs 2>nul",{"section":713,"command":718,"description":719,"options":720,"example":721},"rd \u003Cdir> (or rmdir)","Remove (delete) one or more directories.","\u002Fs also remove files and subdirs; \u002Fq quiet mode (no prompt)","rd \u002Fs \u002Fq C:\\app\\tmp",{"section":713,"command":723,"description":724,"options":725,"example":726},"del \u003Cpattern>","Delete one or more files.","\u002Ff force read-only; \u002Fs delete in subdirs; \u002Fq quiet; \u002Fp prompt per file","del \u002Fs \u002Fq C:\\app\\logs\\*.log",{"section":713,"command":728,"description":729,"options":730,"example":731},"copy \u003Csrc> \u003Cdest>","Copy one or more files to another location.","\u002Fy overwrite without prompt; \u002Fv verify; \u002Fd decrypt dest; \u002Fb binary","copy \u002Fy C:\\src\\config.json D:\\app\\config.json",{"section":713,"command":733,"description":734,"options":735,"example":736},"move \u003Csrc> \u003Cdest>","Move files and rename files or directories.","\u002Fy overwrite; \u002F-y prompt","move \u002Fy C:\\app\\old.log D:\\archive\\",{"section":713,"command":738,"description":739,"example":740},"ren \u003Cold> \u003Cnew>","Rename a file or directory (use only on the filename, not the full path).","ren report.txt report-2026.txt",{"section":713,"command":742,"description":743,"options":744,"example":745},"xcopy \u003Csrc> \u003Cdest>","Copy files, directories, and subdirectories (legacy; superseded by robocopy).","\u002Fs \u002Fe subdirs; \u002Fy overwrite; \u002Fi assume dest is dir; \u002Fh hidden\u002Fsystem; \u002Fd only newer","xcopy \u002Fs \u002Fe \u002Fy \u002Fd C:\\src D:\\dst",{"section":713,"command":747,"description":748,"options":749,"example":750},"robocopy \u003Csrc> \u003Cdest>","Robust file copy for larger jobs, with retry, logging and mirroring.","\u002FMIR mirror; \u002FMOV move (del source); \u002FE subdirs incl empty; \u002FZ restartable; \u002FMT:n multithread; \u002FLOG:\u003Cfile>; \u002FR:n retries; \u002FW:n wait","robocopy C:\\src \\\\\backup\\daily \u002FMIR \u002FZ \u002FMT:8 \u002FLOG+:C:\\logs\\robocopy.txt",{"section":713,"command":752,"description":753,"options":754,"example":755},"attrib [+\u002F-\u003Cattr>] \u003Cpath>","Change file attributes: Read-only (R), Hidden (H), System (S), Archive (A).","\u002Fs recurse; \u002Fd process folders; +R -R read-only on\u002Foff","attrib +R +H secret\\config.ini",{"section":713,"command":757,"description":758,"options":759,"example":760},"mklink [[\u002FD] | \u002FH] \u003Clink> \u003Ctarget>","Create a symbolic (\u002FD) or hard (\u002FH) link to a file or directory.","\u002FD directory symlink; \u002FH hard link; \u002FJ directory junction","mklink \u002FD C:\\current C:\\app\\v2",{"section":762,"command":763,"description":764,"example":765},"Text & Search","type \u003Cfile>","Display the entire contents of a text file on screen.","type C:\\app\\config.json | more",{"section":762,"command":767,"description":768,"example":769},"more \u003C file","Page output one screen at a time (work like Unix less).","type big.log | more",{"section":762,"command":771,"description":772,"options":773,"example":774},"find \"\u003Cstr>\" \u003Cfiles>","Search for a literal string in one or more files (legacy; no regex).","\u002Fi case-insensitive; \u002Fv invert; \u002Fn line numbers; \u002Fc count only","find \u002Fi \u002Fn \"TODO\" *.md",{"section":762,"command":776,"description":777,"options":778,"example":779},"findstr [\u002FR] \u003Cpattern> \u003Cfiles>","Search text with literal strings or regex; supports multiple patterns.","\u002FR regex; \u002FS subdirs; \u002FI case-insensitive; \u002FN line numbers; \u002FM files with matches; \u002FV invert; \u002FC:\"text\" literal string","findstr \u002FR \u002FS \u002FI \u002FN \"TODO\\|FIXME\" *.cs",{"section":762,"command":781,"description":782,"options":783,"example":784},"sort [\u002FR] [\u003Cfile>]","Sort input (or file) alphabetically\u002Fnumerically; sort supports codes via \u002F+N sort key.","\u002FR reverse; \u002F+N sort by char position N; [drive1:][path1] [drive2:][path2] input\u002Foutput","sort \u002FR \u002F+5 unsorted.txt sorted.txt",{"section":762,"command":786,"description":787,"options":788,"example":789},"fc \u002Fb file1 file2","Compare two files; \u002Fb compares byte-by-byte (binary).","\u002Fb binary compare; \u002Fa abbreviated output; \u002Fl line-based; \u002Fn show line numbers","fc \u002Fb file1.bin file2.bin",{"section":791,"command":792,"description":793,"example":794},"System & Disk","systeminfo","Detailed configuration about the host, OS, memory, network.","systeminfo \u002Ffo csv > sysinfo.csv",{"section":791,"command":796,"description":797,"options":798,"example":799},"tasklist [\u002FFI \u003Cfilter>]","List running processes with PID, session, memory, image name.","\u002Fv verbose; \u002FFI filter (e.g., \"IMAGENAME eq cmd.exe\"); \u002FM modules","tasklist \u002FFI \"IMAGENAME eq node.exe\" \u002FFO csv",{"section":791,"command":801,"description":802,"options":803,"example":804},"taskkill \u002FPID \u003Cpid> [\u002FF]","Kill a process by PID (or image name, with \u002FIM).","\u002FF force; \u002FIM image name; \u002FPID pid; \u002FT tree (children too); \u002FFI filter","taskkill \u002FIM chrome.exe \u002FF",{"section":791,"command":806,"description":807,"options":808,"example":809},"sc \\[\\\\host] query|start|stop \u003Cservice>","Communicate with the Service Control Manager; query\u002Fconfig services.","query state= all; start \u002F stop; config starts auto|manual|disabled; create \u002F delete","sc query state= all | more",{"section":791,"command":811,"description":812,"options":813,"example":814},"shutdown [\u002Fs|\u002Fr|\u002Fa]","Log off, restart, or shut down the local\u002Fremote computer.","\u002Fs shutdown; \u002Fr restart; \u002Fa abort; \u002Ft N seconds; \u002Fc \"comment\"; \u002Fm \\\\host; \u002Ff force close apps","shutdown \u002Fr \u002Ft 60 \u002Fc \"Windows Update\"",{"section":791,"command":816,"description":817,"options":818,"example":819},"diskpart","Interactive disk partitioning utility (run as admin); supports list disk\u002Fpartition\u002Fvolume.","list disk \u002F select disk N \u002F clean \u002F create partition primary \u002F format fs=ntfs quick \u002F assign letter=D","diskpart \u002Fs script.txt",{"section":791,"command":821,"description":822,"options":823,"example":824},"chkdsk \u003Cdrive>","Check a disk for errors and recover readable data.","\u002Ff fix errors; \u002Fr recover bad sectors; \u002Fx force dismount; \u002Fv verbose","chkdsk D: \u002Ff \u002Fr \u002Fx",{"section":791,"command":826,"description":827,"example":828},"vol \u003Cdrive>:","Show the volume label and serial number of a drive.","vol C:",{"section":639,"command":830,"description":831,"options":832,"example":833},"ipconfig [\u002Fall|\u002Fflushdns]","Show TCP\u002FIP configuration; \u002Fflushdns clears the DNS client cache.","\u002Fall detail; \u002Frelease \u002F renew DHCP; \u002Fflushdns; \u002Fdisplaydns","ipconfig \u002Fall && ipconfig \u002Fflushdns",{"section":639,"command":835,"description":836,"options":837,"example":838},"ping [-n \u003Ccount>] \u003Chost>","Send ICMP echo requests to test reachability and latency (default 4).","-n count; -t continuous; -l size; -w timeout(ms); -4 \u002F -6 force version","ping -n 6 8.8.8.8",{"section":639,"command":840,"description":841,"options":842,"example":843},"tracert [-d] [-h \u003Chops>] \u003Chost>","Trace the route packets take to a host; -d skips reverse DNS.","-h max hops; -w timeout; -d no DNS; -4 \u002F -6","tracert -d -h 15 google.com",{"section":639,"command":845,"description":846,"options":847,"example":848},"nslookup \u003Chost>","Query DNS — interactive and non-interactive modes.","server 8.8.8.8; type=A\u002FAAAA\u002FMX\u002FCNAME\u002FTXT; -timeout=N","nslookup example.com 1.1.1.1",{"section":639,"command":850,"description":851,"options":852,"example":853},"netstat [-an] [-b]","Display active TCP\u002FUDP connections, listening ports, and the owning process.","-a all; -b owning exe; -n numeric; -o PID; -p tcp|udp; -r routing table","netstat -ano | findstr :443",{"section":639,"command":855,"description":856,"options":857,"example":858},"net [user|localgroup|share|start|stop|use|time|view]","A huge grab-bag for user accounts, shares, services, mapped drives, etc.","net user \u003Cname> \u002Fadd; net localgroup Administrators; net share; net use x: \\\\host\\share","net user alice P@ssw0rd! \u002Fadd && net localgroup Administrators alice \u002Fadd",{"section":860,"command":861,"description":862,"options":863,"example":864},"Batch Scripting","echo [on|off|\u003Ctext>]","Toggle command echoing or print text without a trailing newline (use set \u002Fp instead).","@echo off disables the prefix; & echo. to emit a blank line","@echo off & echo Starting build...",{"section":860,"command":866,"description":867,"options":868,"example":869},"set \u003Cvar>=\u003Cvalue>","Define or modify an environment variable visible to child processes.","set \u002FP var=\"prompt\" read from stdin; set \u002FA var=expr integer math","set \u002FA total = 5 * 20 + 3",{"section":860,"command":871,"description":872,"options":873,"example":874},"if [\u002Fi] [not] \u003Ccondition> cmd","Conditional execution — strings, numbers, errorlevel, exist files.","if exist file; if %var% == value; if %errorlevel% neq 0; if defined","if exist .git (git status) else (git init)",{"section":860,"command":876,"description":877,"options":878,"example":879},"for \u002Ff [...] %%\u003Cvar> in (...) do \u003Ccmd>","Loop constructs: \u002Ff (parse text\u002Fcommand output), \u002Fr (recurse), \u002Fd (dirs), plain (set).","tokens \u002F delims \u002F skip \u002F usebackq for cmd; %%i in interactive scripts vs %i on cmd line","for \u002Ff \"tokens=2 delims=:\" %%p in ('reg query \"HKCU\\Software\\Git\" \u002Fv InstallPath') do set GIT_HOME=%%p",{"section":860,"command":881,"description":882,"options":883,"example":884},"call \u003Cscript> [\u003Cargs>]","Call another batch script and return (vs. plain invocation, which stops the caller).","? shows help; \u002Fe:on enable extensions; \u002Fv:on delayed expansion","call utils\\env.bat && call build\\compile.bat",{"section":860,"command":886,"description":887,"options":888,"example":889},"goto \u002F rem \u002F exit","Labels (goto :label), comments (rem), and explicit exit codes.","exit \u002Fb \u003Ccode>; comment blocks with rem ←→ ... reset","exit \u002Fb 1",{"title":891,"description":892,"commands":893},"Docker Commands Cheat Sheet","Quick reference for everyday Docker CLI commands: container lifecycle, image builds, logs \u002F exec, networking, volumes, Compose, registry and housekeeping — with common options and practical examples.",[894,900,905,910,915,919,924,928,932,938,943,948,953,959,964,968,974,979,984,988,993,998,1003,1008,1013,1018,1023,1028,1034,1039,1044,1048,1054,1059,1064,1069,1074,1079,1085,1089,1094,1100,1105,1110,1115,1120],{"section":895,"command":896,"description":897,"options":898,"example":899},"Container Lifecycle","docker run \u003Cimage>","Create and start a new container from an image.","-d detached; -it interactive TTY; --name assign name; -p host:container publish port; -v mount volume; -e KEY=VAL env; --rm auto-remove on exit; --restart=always|unless-stopped|on-failure","docker run -d --name web -p 8080:80 -v $PWD:\u002Fusr\u002Fshare\u002Fnginx\u002Fhtml:ro nginx:alpine",{"section":895,"command":901,"description":902,"options":903,"example":904},"docker start|stop|restart \u003Ccontainer>","Start, stop or restart an existing container (by name or id).","-t N seconds to wait before kill (default 10)","docker restart web && docker logs --tail 50 web",{"section":895,"command":906,"description":907,"options":908,"example":909},"docker rm \u003Ccontainer>","Remove one or more stopped containers.","-f force-remove running; -v also remove anonymous volumes","docker rm -f $(docker ps -aq)",{"section":895,"command":911,"description":912,"options":913,"example":914},"docker ps","List containers (default: only running).","-a all; -q quiet (ids only); -s with size; --format go-template; --filter status|name=...","docker ps --format 'table {{.Names}}\\t{{.Image}}\\t{{.Status}}\\t{{.Ports}}'",{"section":895,"command":916,"description":917,"example":918},"docker rename \u003Cc> \u003Cnew>","Rename a container.","docker rename web-1 gateway-web",{"section":895,"command":920,"description":921,"options":922,"example":923},"docker update \u003Cc>","Update a container's resource limits or restart policy at runtime.","--cpus N; --memory SIZE; --memory-swap SIZE; --restart policy","docker update --cpus 1.5 --memory 1g api",{"section":895,"command":925,"description":926,"example":927},"docker wait \u003Cc>","Block until the container stops, then print its exit code.","docker wait db && echo \"db stopped\"",{"section":895,"command":929,"description":930,"example":931},"docker top \u003Cc>","Show running processes inside a container (ps of the host PID namespace).","docker top web",{"section":933,"command":934,"description":935,"options":936,"example":937},"Logs & Exec","docker logs \u003Cc>","Fetch logs of a container.","-f follow; --tail N; --since timestamp|duration; -t with timestamps; --details","docker logs -f --tail 200 -t api | grep ERROR",{"section":933,"command":939,"description":940,"options":941,"example":942},"docker exec -it \u003Cc> \u003Ccmd>","Run a command inside a running container (commonly an interactive shell).","-i keep STDIN open; -t allocate a pseudo-TTY; -u user; -w workdir; -e KEY=VAL","docker exec -it -u postgres db psql -U postgres app_production",{"section":933,"command":944,"description":945,"options":946,"example":947},"docker attach \u003Cc>","Attach local STDIN\u002FSTDOUT to a running container (same as `docker start -i`).","--sig-proxy proxy signals; --no-stdin","docker attach web && Ctrl-p Ctrl-q to detach",{"section":933,"command":949,"description":950,"options":951,"example":952},"docker cp \u003Cc>:\u003Csrc> \u003Cdest>","Copy files\u002Ffolders between a container and the local filesystem.","-L follow symlink; -a archive mode","docker cp db:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata .\u002Fpgdata",{"section":954,"command":955,"description":956,"options":957,"example":958},"Inspection","docker inspect \u003Cobj>","Return low-level info on Docker objects (container, image, volume, network).","-f go-template; --type container|image|network|volume; -s size","docker inspect -f '{{.NetworkSettings.IPAddress}}' web",{"section":954,"command":960,"description":961,"options":962,"example":963},"docker stats","Live stream of CPU \u002F memory \u002F network \u002F disk usage for running containers.","--no-stream one shot; -a all (incl stopped); --format; --no-trunc","docker stats --format 'table {{.Name}}\\t{{.CPUPerc}}\\t{{.MemUsage}}'",{"section":954,"command":965,"description":966,"example":967},"docker diff \u003Cc>","Inspect changes (added \u002F changed \u002F deleted) on a container's filesystem.","docker diff web | head -20",{"section":969,"command":970,"description":971,"options":972,"example":973},"Image Operations","docker pull \u003Cimage>[:tag]","Pull an image (or repository) from a registry.","-a all tagged images; --platform linux\u002Famd64; -q quiet; --disable-content-trust","docker pull --platform linux\u002Famd64 nginx:1.27-alpine",{"section":969,"command":975,"description":976,"options":977,"example":978},"docker images","List images on the local daemon.","-a all (incl intermediate); -q ids only; --digests; --filter dangling=true","docker images --format '{{.Repository}}:{{.Tag}}\\t{{.Size}}' | sort -k2 -h | tail -20",{"section":969,"command":980,"description":981,"options":982,"example":983},"docker build \u003Cpath>","Build an image from a Dockerfile.","-t name:tag; -f Dockerfile path; --no-cache; --build-arg KEY=VAL; --target stage; --progress=plain; --platform","docker build -t myapp:dev --build-arg NODE_ENV=development --progress=plain .",{"section":969,"command":985,"description":986,"example":987},"docker tag \u003Csrc> \u003Cdest>","Create a tag that points to an existing image (alias \u002F push target).","docker tag myapp:dev registry.example.com\u002Fteam\u002Fmyapp:1.2.0",{"section":969,"command":989,"description":990,"options":991,"example":992},"docker push \u003Cimage>","Upload an image (or repository) to a registry.","--disable-content-trust; -a all tagged variants; --quiet","docker push registry.example.com\u002Fteam\u002Fmyapp:1.2.0",{"section":969,"command":994,"description":995,"options":996,"example":997},"docker rmi \u003Cimage>","Remove one or more images.","-f force (untag also when children); --no-prune keep untagged parents","docker rmi -f $(docker images --filter 'dangling=true' -q)",{"section":969,"command":999,"description":1000,"options":1001,"example":1002},"docker image prune \u002F docker save \u002F docker load","Reclaim space (filter dangling\u002Folder than Xh); save\u002Fload image to\u002Ffrom tar.","-a all; --filter 'until=24h'; -o file.tar; -i file.tar","docker image prune -af --filter 'until=72h' && docker save -o nginx.tar nginx:alpine",{"section":969,"command":1004,"description":1005,"options":1006,"example":1007},"docker history \u003Cimage>","Show the layers \u002F intermediate history of an image.","--no-trunc; --human; -q ids","docker history --no-trunc --human myapp:dev",{"section":445,"command":1009,"description":1010,"options":1011,"example":1012},"docker network ls","List networks.","--filter driver=bridge|overlay; -q ids; --format","docker network ls --filter driver=bridge --format '{{.Name}}'",{"section":445,"command":1014,"description":1015,"options":1016,"example":1017},"docker network create \u003Cname>","Create a user-defined bridge network for service discovery & DNS.","--driver bridge|overlay|macvlan; --subnet CIDR; --gateway; --ipv6; --internal","docker network create --driver bridge --subnet 10.20.0.0\u002F24 mynet",{"section":445,"command":1019,"description":1020,"options":1021,"example":1022},"docker network connect|disconnect \u003Cnet> \u003Cc>","Attach \u002F detach a running container to a network.","--ip IPV4; --ip6 IPV6; --alias hostname alias; --link container","docker network connect mynet web",{"section":445,"command":1024,"description":1025,"options":1026,"example":1027},"docker network rm \u002F docker network prune","Remove one or more networks \u002F clean up unused.","-f force; --filter 'until=24h'","docker network prune -f",{"section":1029,"command":1030,"description":1031,"options":1032,"example":1033},"Volume & Storage","docker volume ls","List volumes.","--filter dangling=true|driver|name; -q ids; --format","docker volume ls --filter dangling=true -q",{"section":1029,"command":1035,"description":1036,"options":1037,"example":1038},"docker volume create \u003Cname>","Create a named volume (managed by Docker, out of container's UFS).","--driver local; --opt type=nfs; --opt o=addr; --opt device=:\u002Fpath","docker volume create --driver local --opt type=nfs --opt o=addr=10.0.0.1 --opt device=:\u002Fexports\u002Fdata pgdata",{"section":1029,"command":1040,"description":1041,"options":1042,"example":1043},"docker volume rm \u002F docker volume prune","Remove one or more volumes \u002F clean up unused.","-f force; --filter 'label=...'","docker volume rm $(docker volume ls -q --filter dangling=true)",{"section":1029,"command":1045,"description":1046,"example":1047},"docker volume inspect \u003Cvol>","Show low-level details of a volume (mountpoint, driver, options).","docker volume inspect pgdata --format '{{.Mountpoint}}'",{"section":1049,"command":1050,"description":1051,"options":1052,"example":1053},"Docker Compose","docker compose up","Build (if needed), create and start services from compose.yaml.","-d detached; --build force build; --force-recreate; --pull always|missing|never; -f file","docker compose -f compose.prod.yaml up -d --pull always",{"section":1049,"command":1055,"description":1056,"options":1057,"example":1058},"docker compose down","Stop and remove containers, networks; default also removes anonymous volumes.","--volumes named vols too; --rmi all|local; --remove-orphans; -t N timeout","docker compose down --rmi local --remove-orphans",{"section":1049,"command":1060,"description":1061,"options":1062,"example":1063},"docker compose ps \u002F logs","List Compose services \u002F view logs.","ps -q ids only; logs -f follow; --tail N; --since","docker compose ps --format json | jq '.[] | {Name, State}' && docker compose logs -f --tail 100 api",{"section":1049,"command":1065,"description":1066,"options":1067,"example":1068},"docker compose exec \u002F run","Run a command in a running \u002F new service container.","exec --user; exec -e VAR=val; run --rm removes container after","docker compose exec db psql -U postgres app && docker compose run --rm api npm run migrate",{"section":1049,"command":1070,"description":1071,"options":1072,"example":1073},"docker compose build \u002F pull \u002F push","Build images \u002F pull images from registry \u002F push images to registry for a Compose project.","--no-cache; --pull; --quiet; --parallel","docker compose build --no-cache api worker",{"section":1049,"command":1075,"description":1076,"options":1077,"example":1078},"docker compose restart \u002F stop \u002F start \u002F scale","Lifecycle shortcuts for services; scale adjusts the number of replicas.","restart \u003Csvc>; stop \u003Csvc>; start \u003Csvc>; scale api=4 worker=2","docker compose restart api && docker compose up -d --scale worker=4",{"section":1080,"command":1081,"description":1082,"options":1083,"example":1084},"Registry & Hub","docker login [server]","Authenticate to a registry. Use `docker login` for Docker Hub.","-u user; -p password; --password-stdin","echo \"$REGISTRY_TOKEN\" | docker login ghcr.io -u myuser --password-stdin",{"section":1080,"command":1086,"description":1087,"example":1088},"docker logout [server]","Remove credentials for a registry from config.","docker logout && docker info 2>\u002Fdev\u002Fnull | head",{"section":1080,"command":1090,"description":1091,"options":1092,"example":1093},"docker search \u003Cterm>","Search Docker Hub for images.","--filter stars=N; --limit N; --format","docker search --filter stars=100 --limit 5 postgres",{"section":1095,"command":1096,"description":1097,"options":1098,"example":1099},"System & Cleanup","docker system df","Show docker disk usage (images, containers, volumes, build cache).","-v verbose","docker system df -v | sort -k7 -h | tail",{"section":1095,"command":1101,"description":1102,"options":1103,"example":1104},"docker system prune","Remove all stopped containers, dangling images, unused networks.","-a all images; --volumes also volumes; --filter 'until=24h'; -f force","docker system prune -af --volumes --filter 'until=72h'",{"section":1095,"command":1106,"description":1107,"options":1108,"example":1109},"docker builder prune","Clean the build cache (free disk space from old layers).","-af; --filter 'until=72h'; --keep-storage SIZE","docker builder prune -af --filter 'until=72h'",{"section":1095,"command":1111,"description":1112,"options":1113,"example":1114},"docker context ls \u002F use","Manage Docker contexts — for multi-host \u002F multi-daemon (incl remote contexts over SSH).","ls --format json; use myctx","docker context create myhost --docker host=ssh:\u002F\u002Fuser@server && docker context use myhost && docker ps",{"section":1095,"command":1116,"description":1117,"options":1118,"example":1119},"docker info","Display system-wide information; useful when debugging.","--format","docker info -f '{{.DriverStatus}}'",{"section":1095,"command":1121,"description":1122,"example":1123},"docker port \u003Cc>","List port mappings (host ↔ container) for a container.","docker port web 80",{"title":1125,"description":1126,"commands":1127},"kubectl Cheat Sheet","Quick reference for kubectl, the Kubernetes command-line client: contexts, get\u002Fdescribe, apply, logs\u002Fexec, rollout, scaling and debugging — with common options and practical examples.",[1128,1134,1139,1144,1148,1153,1157,1163,1168,1173,1178,1182,1188,1193,1198,1203,1208,1213,1218,1223,1228,1233,1238,1243,1248,1254,1259,1264,1269,1274,1280,1285,1290,1296,1301,1306,1311,1316,1322,1327],{"section":1129,"command":1130,"description":1131,"options":1132,"example":1133},"Cluster & Context","kubectl version","Print client and server version info (useful for debugging version skew).","--client client only; -o yaml\u002Fjson","kubectl version -o yaml | yq '.clientVersion.minor' ",{"section":1129,"command":1135,"description":1136,"options":1137,"example":1138},"kubectl cluster-info","Show info about master and services in the cluster.","--context ctx; --output json|yaml","kubectl cluster-info --context prod-eu",{"section":1129,"command":1140,"description":1141,"options":1142,"example":1143},"kubectl config get-contexts","List all contexts in the kubeconfig file.","--minify; -o name|json|yaml","kubectl config get-contexts -o name | xargs -I{} echo {}",{"section":1129,"command":1145,"description":1146,"example":1147},"kubectl config use-context \u003Cname>","Switch the current context.","kubectl config use-context prod-eu",{"section":1129,"command":1149,"description":1150,"options":1151,"example":1152},"kubectl config current-context \u002F set-context \u003Cname>","Read or rename \u002F update a context (set namespace, cluster, user).","--current print current; set-context --namespace N --cluster C --user U","kubectl config set-context dev-team-a --namespace shop --cluster dev --user dev",{"section":1129,"command":1154,"description":1155,"example":1156},"kubectl config set \u003Cname> \u003Cvalue>","Change the per-context default namespace so subsequent commands skip -n.","kubectl config set-context --current --namespace=argocd && kubectl get pods",{"section":1158,"command":1159,"description":1160,"options":1161,"example":1162},"Get & Inspect","kubectl get all","List pods, services, deployments, replicasets, statefulsets, etc.","-A all namespaces; -n ns; -l label=key=value selector; -o wide|yaml|json|name|custom-columns; --sort-by","kubectl get all -A -o wide | grep -i Error",{"section":1158,"command":1164,"description":1165,"options":1166,"example":1167},"kubectl get pods \u002F svc \u002F deploy \u002F ds \u002F sts","List a specific resource type (the most common resources).","-A; -l app=api; -o wide (shows node, ip); --field-selector; --sort-by .metadata.creationTimestamp","kubectl get pod -n kube-system -l k8s-app=metrics-server -o wide",{"section":1158,"command":1169,"description":1170,"options":1171,"example":1172},"kubectl get -o yaml|json","Dump the full object as YAML\u002FJSON for inspection or export.","-o yaml; --export save without cluster-set fields","kubectl get deploy api -n shop -o yaml | grep -E 'image|replicas|envFrom'",{"section":1158,"command":1174,"description":1175,"options":1176,"example":1177},"kubectl describe \u003Ctype> \u003Cname>","Show low-level details, events, container state, lifecycle — best for debugging.","-n ns; -A all ns; --show-events=true","kubectl describe pod api-7c5d-xn2kq -n shop | tail -50",{"section":1158,"command":1179,"description":1180,"example":1181},"kubectl explain \u003Cresource[.field]>","Show schema \u002F fields documentation straight from the API server.","kubectl explain pod.spec.containers.resources.limits",{"section":1183,"command":1184,"description":1185,"options":1186,"example":1187},"Apply & Manage","kubectl apply -f \u003Cfile|dir|url>","Apply or update manifests to match the cluster state (declarative).","-f file|dir|URL; -R recursive dir; --prune; --force-conflicts server-side apply; --server-side","kubectl apply -k overlays\u002Fprod && kubectl apply -f https:\u002F\u002F...\u002Fmanifests.yaml",{"section":1183,"command":1189,"description":1190,"options":1191,"example":1192},"kubectl diff -f \u003Cfile>","Show what `apply` would change (requires KUBECTL_EXTERNAL_DIFF or diff binary).","-R; --server-side; --prune","kubectl diff -f overlays\u002Fprod | head -50",{"section":1183,"command":1194,"description":1195,"options":1196,"example":1197},"kubectl create|delete -f \u003Cfile>","Imperative create or delete from a manifest (one-shot).","create -f; delete -f; delete pod foo; delete svc,deploy -l app=foo (composite)","kubectl delete -f bad-app.yaml --grace-period=0 --force",{"section":1183,"command":1199,"description":1200,"options":1201,"example":1202},"kubectl edit \u003Ctype> \u003Cname>","Open the live object in your editor (defaults to vi).","-o yaml; --save-config; --windows-line-ending","KUBE_EDITOR=\"code --wait\" kubectl edit deploy api -n shop",{"section":1183,"command":1204,"description":1205,"options":1206,"example":1207},"kubectl patch \u003Ctype> \u003Cname> --patch '\u003Cjson>'","Apply a strategic-merge or JSON-patch to the live object.","--type strategic|merge|json; --patch-file file.json","kubectl patch deploy api -n shop --type merge -p '{\"spec\":{\"replicas\":6}}'",{"section":1183,"command":1209,"description":1210,"options":1211,"example":1212},"kubectl set image \u003Ctype> \u003Cname> container=image","Trigger a rollout with a new image; mirrors `set image env \u002F resources`.","set image env \u002F resources \u002F serviceaccount \u002F subject \u002F selector","kubectl set image deploy\u002Fapi api=ghcr.io\u002Fteam\u002Fapi:1.4.2 && kubectl rollout status deploy\u002Fapi",{"section":1183,"command":1214,"description":1215,"options":1216,"example":1217},"kubectl label \u002F annotate \u003Ctype> \u003Cname>","Add or update labels \u002F annotations on live objects.","key=value add; key- remove (ends in -); --overwrite","kubectl label pod -n shop -l app=api release=v1.4.2 --overwrite",{"section":933,"command":1219,"description":1220,"options":1221,"example":1222},"kubectl logs \u003Cpod>","Print the logs of a pod (or a specific container with -c).","-f follow; --tail N; --since R|D|T; --timestamps; -c container; --all-containers; -p previous","kubectl logs -n shop -f --tail 100 --timestamps api-7c5d-xn2kq",{"section":933,"command":1224,"description":1225,"options":1226,"example":1227},"kubectl logs --previous","Show the logs of the previous instance of a container (after a crash \u002F rollout).","-c container; --tail N","kubectl logs -p api-7c5d-xn2kq -c api --tail 200 | grep panic",{"section":933,"command":1229,"description":1230,"options":1231,"example":1232},"kubectl logs -l \u003Clabel> --all-containers","Aggregate logs across all pods matching a label — great for deployments.","-l app=api; --all-containers=true; -f; --max-log-requests N","kubectl logs -n shop -l app=worker --all-containers -f --max-log-requests 8",{"section":933,"command":1234,"description":1235,"options":1236,"example":1237},"kubectl exec -it \u003Cpod> -- \u003Ccmd>","Run a command inside a pod, optionally interactive (bash\u002Fsh).","-it; -c container; -n ns; -- \u002Fbin\u002Fsh","kubectl exec -n shop -it api-7c5d-xn2kq -- \u002Fbin\u002Fsh -c 'printenv | grep DATABASE'",{"section":933,"command":1239,"description":1240,"options":1241,"example":1242},"kubectl cp \u003Cpod>:\u003Csrc> \u003Cdest>","Copy files\u002Ffolders in\u002Fout of a pod (uses tar over exec).","-c container; -n ns","kubectl cp shop\u002Fapi-7c5d-xn2kq:app\u002Fconfig.yaml .\u002Fconfig.yaml",{"section":933,"command":1244,"description":1245,"options":1246,"example":1247},"kubectl port-forward \u003Cpod> \u003Clocal>:remote>","Forward one or more local ports to a pod (or svc, deploy).","pod\u002F\u003Cname> \u003Cl>:r; svc\u002F\u003Cname> \u003Cl>:r; --address 127.0.0.1","kubectl port-forward svc\u002Fargocd-server -n argocd 8443:443",{"section":1249,"command":1250,"description":1251,"options":1252,"example":1253},"Rollout & Scale","kubectl rollout status deploy\u002F\u003Cname>","Watch the progress of a rolling update until it's ready (or times out).","--timeout 5m; --revision N","kubectl rollout status deploy\u002Fapi -n shop --timeout 2m",{"section":1249,"command":1255,"description":1256,"options":1257,"example":1258},"kubectl rollout history \u002F undo","Show the rollout history \u002F roll back to a previous revision.","history --revision N; undo --to-revision N; --dry-run=client","kubectl rollout history deploy\u002Fapi -n shop && kubectl rollout undo deploy\u002Fapi --to-revision=3",{"section":1249,"command":1260,"description":1261,"options":1262,"example":1263},"kubectl rollout restart deploy\u002F\u003Cname>","Restart a Deployment (or DaemonSet\u002FStatefulSet) by patching the pod template.","-n ns","kubectl rollout restart deploy api -n shop && kubectl get pods -l app=api -w",{"section":1249,"command":1265,"description":1266,"options":1267,"example":1268},"kubectl scale deploy\u002F\u003Cn> --replicas=N","Manually set replica count; doesn't change the manifest.","--current-replicas check first; --dry-run=client -o yaml","kubectl scale deploy\u002Fapi -n shop --current-replicas 2 --replicas 6",{"section":1249,"command":1270,"description":1271,"options":1272,"example":1273},"kubectl autoscale deploy\u002F\u003Cn> --min=2 --max=10 --cpu-percent=80","Create an HPA with the given bounds (or use `kubectl create hpa`).","--max --min --cpu-percent; --dry-run=client -o yaml","kubectl autoscale deploy\u002Fapi -n shop --min=3 --max=15 --cpu-percent=70",{"section":1275,"command":1276,"description":1277,"options":1278,"example":1279},"Node & Pod Lifecycle","kubectl drain \u003Cnode> --ignore-daemonsets --delete-emptydir-data","Safely evict pods from a node before maintenance (e.g. upgrade).","--grace-period N; --force; --skip-errors; --dry-run; --delete-emptydir-data","kubectl drain ip-10-0-1-7 --ignore-daemonsets --delete-emptydir-data --grace-period 60",{"section":1275,"command":1281,"description":1282,"options":1283,"example":1284},"kubectl cordon \u002F uncordon \u003Cnode>","Mark a node unschedulable (cordon) \u002F schedulable (uncordon). Use uncordon after maintenance.","--name on implicit, no flag needed","kubectl cordon ip-10-0-1-7 && kubectl uncordon ip-10-0-1-7",{"section":1275,"command":1286,"description":1287,"options":1288,"example":1289},"kubectl delete pod \u003Cpod>","Delete a pod — for Deployments the controller will create a new one (used to force-restart a single instance).","--grace-period=0 --force; -n ns; --now","kubectl delete pod -n shop api-7c5d-xn2kq --grace-period=0 --force",{"section":1291,"command":1292,"description":1293,"options":1294,"example":1295},"Debug","kubectl top node \u002F pod","Show live CPU\u002FMemory usage (requires metrics-server).","--sort-by cpu|memory; --containers; -A; -l","kubectl top node && kubectl top pod -A --sort-by=memory | head",{"section":1291,"command":1297,"description":1298,"options":1299,"example":1300},"kubectl debug \u003Cpod>","Attach a debug container with extra debugging tools (kubectl-debug \u002F Ephemeral Containers).","--image \u003Cimg>; --target-container; --share-processes; --profile","kubectl debug -it api-7c5d-xn2kq --image=nicolaka\u002Fnetshoot --target-container=api",{"section":1291,"command":1302,"description":1303,"options":1304,"example":1305},"kubectl get events --sort-by=.lastTimestamp","Tail cluster events to find scheduling \u002F image pull \u002F probe failures.","--field-selector involvedObject.name=podX; -A; -w; --watch-only-events","kubectl get events -n shop --sort-by=.lastTimestamp -w | grep -v 'Normal'",{"section":1291,"command":1307,"description":1308,"options":1309,"example":1310},"kubectl auth can-i \u003Cverb> \u003Cresource>","Check what your current user can do — great for RBAC debugging.","--as user; --as-group; -n ns; --all-namespaces","kubectl auth can-i create pods -n prod --as system:serviceaccount:team-a:deployer",{"section":1291,"command":1312,"description":1313,"options":1314,"example":1315},"kubectl wait --for=condition=Ready","Block until a resource reaches the desired condition (use in CI\u002Fscripts).","--for condition=Ready|Available; --timeout 60s; --all --selector","kubectl wait -n shop --for=condition=Available deploy\u002Fapi --timeout 120s",{"section":1317,"command":1318,"description":1319,"options":1320,"example":1321},"Resources & Manifests","kubectl create cm|secret ... --from-file|--from-literal","Imperative create of ConfigMap \u002F Secret (use `kubectl create secret generic ...`).","--from-file; --from-literal=KEY=val; --dry-run=client -o yaml","kubectl -n shop create secret generic api-creds --from-literal=API_KEY=$(cat key.txt)",{"section":1317,"command":1323,"description":1324,"options":1325,"example":1326},"kubectl create token \u003Cserviceaccount>","Mint a short-lived token for a ServiceAccount (recommended over static secrets).","--duration 24h","kubectl -n shop create token deployer --duration=12h | pbcopy",{"section":1317,"command":1328,"description":1329,"example":1330},"kubectl get secret \u003Cname> -o jsonpath='{.data.K}' | base64 -d","Decode a base64 secret key for one-off inspection.","kubectl -n shop get secret api-creds -o jsonpath='{.data.API_KEY}' | base64 -d",{"title":1332,"description":1333,"commands":1334},"PostgreSQL Commands Cheat Sheet","Quick reference for PostgreSQL: psql client commands, DDL\u002FDML statements, joins\u002Faggregates, indexes, transactions and backup\u002Frestore — with common options and practical examples.",[1335,1341,1345,1351,1356,1360,1364,1368,1372,1378,1383,1387,1393,1398,1403,1407,1413,1418,1423,1429,1434,1440,1444,1450,1456,1461,1466,1471,1477,1482,1488,1493,1497,1503,1508],{"section":1336,"command":1337,"description":1338,"options":1339,"example":1340},"Connection","psql -h \u003Chost> -p \u003Cport> -U \u003Cuser> -d \u003Cdb>","Open an interactive psql session against a remote or local database.","-h host; -p 5432 default; -U user; -d dbname; -W force password; -f file run script; -c one command","PGPASSWORD=secret psql -h db.example.com -U app -d app_production",{"section":1336,"command":1342,"description":1343,"example":1344},"psql -U \u003Cuser> \u003Cdb> --variable='ON_ERROR_STOP=1' -f \u003Cfile.sql>","Run a SQL script against a database, stop on the first error.","psql -U app -d app -v ON_ERROR_STOP=1 -f migrations\u002F0001_init.sql",{"section":1346,"command":1347,"description":1348,"options":1349,"example":1350},"psql Meta-Commands","\\l[+]   \\c[onnect] [\u003Cdb>]","List databases; then connect to one.","\\l+ with size\u002Ftblsp info; \\c db user change target","\\l+; \\c app_dev",{"section":1346,"command":1352,"description":1353,"options":1354,"example":1355},"\\dt[+] [\u003Cpattern>]","List tables in the current schema matching a pattern (default: public).","\\dt+ size+desc; \\dt *.* all schemas; \\d table describe a table","\\dt+ public.*",{"section":1346,"command":1357,"description":1358,"example":1359},"\\d \u003Ctable|view|index|seq|matview>","Describe object structure: columns, indexes, FKs, comments.","\\d orders",{"section":1346,"command":1361,"description":1362,"example":1363},"\\dn \u002F \\du \u002F \\dv \u002F \\di","List schemas \u002F roles \u002F views \u002F indexes respectively.","\\du; \\di+ idx_orders_user_id",{"section":1346,"command":1365,"description":1366,"example":1367},"\\timing \u002F \\x \u002F \\? \u002F \\q","Toggle query timing; expanded display; show help; quit the session.","\\timing on; \\x auto; SELECT * FROM orders LIMIT 2; \\q",{"section":1346,"command":1369,"description":1370,"example":1371},"\\copy \u003Ctable> FROM '\u003Cfile>' DELIMITER ',' CSV HEADER","Bulk load data from a file (server-side, but uses client filesystem).","\\copy orders(order_id,user_id,total,created_at) FROM '\u002Ftmp\u002Forders.csv' WITH CSV HEADER",{"section":1373,"command":1374,"description":1375,"options":1376,"example":1377},"Database & Schema","CREATE DATABASE \u003Cdb>","Create a new database with the template database options.","OWNER role; TEMPLATE template0; ENCODING 'UTF8'; LC_COLLATE","CREATE DATABASE app_dev OWNER app_user ENCODING 'UTF8' TEMPLATE template0",{"section":1373,"command":1379,"description":1380,"options":1381,"example":1382},"DROP DATABASE \u003Cdb>","Drop a database (must not be in use; often done with IF EXISTS + force).","DROP DATABASE WITH (FORCE); postgres 13+","DROP DATABASE IF EXISTS app_old;",{"section":1373,"command":1384,"description":1385,"example":1386},"CREATE SCHEMA \u002F DROP SCHEMA","Namespace for tables\u002Fviews; part of the default search_path.","CREATE SCHEMA IF NOT EXISTS audit; DROP SCHEMA staging CASCADE;",{"section":1388,"command":1389,"description":1390,"options":1391,"example":1392},"Tables & DDL","CREATE TABLE","Define a new table with columns, types, defaults and constraints.","PRIMARY KEY; FOREIGN KEY ... REFERENCES; UNIQUE; CHECK; INHERITS; PARTITION BY RANGE|LIST","CREATE TABLE orders (id bigserial PRIMARY KEY, user_id int NOT NULL REFERENCES users(id), total numeric(10,2) NOT NULL DEFAULT 0, created_at timestamptz NOT NULL DEFAULT now());",{"section":1388,"command":1394,"description":1395,"options":1396,"example":1397},"ALTER TABLE","Add\u002Fdrop\u002Frename columns, change types, add constraints, set storage params.","ADD COLUMN; DROP COLUMN; RENAME TO; ADD CONSTRAINT; ALTER COLUMN ... TYPE","ALTER TABLE orders ADD COLUMN currency char(3) NOT NULL DEFAULT 'USD', ADD CONSTRAINT chk_cur CHECK (currency IN ('USD','EUR','CNY'));",{"section":1388,"command":1399,"description":1400,"options":1401,"example":1402},"DROP TABLE \u002F TRUNCATE","Remove a table (CASCADE if FK-referenced); TRUNCATE empties it fast.","DROP TABLE ... CASCADE; TRUNCATE ... RESTART IDENTITY CASCADE","TRUNCATE TABLE staging.events RESTART IDENTITY CASCADE;",{"section":1388,"command":1404,"description":1405,"example":1406},"COMMENT ON \u003Ctable|column> IS '...'","Annotate database objects — surfaced by \\d+ and IDE tooltips.","COMMENT ON COLUMN orders.total IS 'Subtotal before tax' ",{"section":1408,"command":1409,"description":1410,"options":1411,"example":1412},"DML","INSERT INTO \u003Ctable> [(cols)] VALUES (...) [RETURNING ...]","Insert one or more rows; RETURNING reveals columns of the inserted row.","INSERT ... SELECT; ON CONFLICT DO NOTHING \u002F DO UPDATE (upsert); RETURNING","INSERT INTO orders(user_id, total) VALUES (42, 19.95) RETURNING id, created_at;",{"section":1408,"command":1414,"description":1415,"options":1416,"example":1417},"UPDATE ... SET ... [WHERE ...] [RETURNING ...]","Modify matching rows; always scope with WHERE unless intentional.","UPDATE ... FROM t2 WHERE ...; CTE (WITH ...) + UPDATE; ... RETURNING","UPDATE orders SET status='paid' WHERE user_id = 42 AND created_at \u003C now() - interval '7 days' RETURNING id;",{"section":1408,"command":1419,"description":1420,"options":1421,"example":1422},"DELETE FROM ... [WHERE ...] [RETURNING ...]","Delete matching rows; TRUNCATE is faster when emptying whole tables.","DELETE ... USING t2 WHERE ...; RETURNING","DELETE FROM orders WHERE status='cancelled' AND created_at \u003C now() - interval '30 days' RETURNING id;",{"section":1424,"command":1425,"description":1426,"options":1427,"example":1428},"Query & Filter","SELECT ... FROM ... WHERE ... ORDER BY ... LIMIT N OFFSET M","Read rows with filtering, ordering and pagination.","WHERE col op ANY\u002FALL(array); LIMIT n OFFSET n; FETCH FIRST n ROWS ONLY; FOR UPDATE\u002FSHARE locks","SELECT id, status, total FROM orders WHERE user_id = 42 ORDER BY created_at DESC LIMIT 10 OFFSET 20;",{"section":1424,"command":1430,"description":1431,"options":1432,"example":1433},"DISTINCT \u002F GROUP BY \u002F HAVING","Eliminate duplicates, aggregate by columns, then filter on aggregates.","GROUP BY ROLLUP(a,b); GROUPING SETS; HAVING filter on aggregates; FILTER (WHERE ...) keep NULLs","SELECT user_id, count(*) FILTER (WHERE status='paid') AS paid, sum(total) AS gmv FROM orders GROUP BY user_id HAVING count(*) >= 3;",{"section":1435,"command":1436,"description":1437,"options":1438,"example":1439},"Joins","[INNER | LEFT | RIGHT | FULL] JOIN ... ON ...","Combine rows from multiple tables; LEFT JOIN keeps unmatched left rows.","JOIN LATERAL; NATURAL JOIN; USING(col) instead of ON; CROSS JOIN products","SELECT u.email, count(o.id) FROM users u LEFT JOIN orders o ON o.user_id = u.id GROUP BY u.email;",{"section":1435,"command":1441,"description":1442,"example":1443},"WITH cte AS (...) SELECT ...","Materialize subqueries as CTEs; recursive CTEs for hierarchies\u002Fgraphs.","WITH RECURSIVE tree AS (SELECT id, parent_id, name FROM cats WHERE parent_id IS NULL UNION ALL SELECT c.id, c.parent_id, c.name FROM cats c JOIN tree t ON c.parent_id = t.id) SELECT * FROM tree;",{"section":1445,"command":1446,"description":1447,"options":1448,"example":1449},"Aggregate","count() \u002F sum() \u002F avg() \u002F min() \u002F max() \u002F array_agg() \u002F string_agg()","Built-in aggregate functions; great with FILTER clauses or GROUP BY.","DISTINCT inside count\u002Fsum; ORDER BY inside array_agg(string_agg)","SELECT date_trunc('day', created_at) AS day, sum(total) AS gmv FROM orders GROUP BY day ORDER BY day DESC LIMIT 7;",{"section":1451,"command":1452,"description":1453,"options":1454,"example":1455},"Index & View","CREATE INDEX ...","Accelerate WHERE\u002FORDER BY; partial indexes can target hot subsets.","CONCURRENTLY (no exclusive lock); INCLUDE (a,b) covering; USING btree|gin|gist|hash; partial WHERE","CREATE INDEX CONCURRENTLY idx_orders_user_created ON orders(user_id, created_at DESC) INCLUDE (total);",{"section":1451,"command":1457,"description":1458,"options":1459,"example":1460},"EXPLAIN [ANALYZE] \u003Cquery>","Show the query plan; ANALYZE executes and reports actual times & rows.","EXPLAIN (ANALYZE, BUFFERS, VERBOSE); FORMAT JSON \u002F TEXT \u002F YAML","EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM orders WHERE user_id = 42 ORDER BY created_at DESC LIMIT 10;",{"section":1451,"command":1462,"description":1463,"options":1464,"example":1465},"VACUUM \u002F ANALYZE \u002F REINDEX","Maintain storage and stats: reuse dead tuples, refresh planner stats, rebuild indexes.","VACUUM (FULL) table rewrite; ANALYZE update stats; REINDEX rebuild; autovacuum normally handles this","VACUUM (ANALYZE) orders;",{"section":1451,"command":1467,"description":1468,"options":1469,"example":1470},"CREATE VIEW \u002F MATERIALIZED VIEW","Stored query; materialized view actually caches rows (refresh required).","CREATE OR REPLACE VIEW; MATERIALIZED VIEW ... WITH NO DATA; REFRESH MATERIALIZED VIEW CONCURRENTLY","CREATE MATERIALIZED VIEW mv_user_orders AS SELECT user_id, count(*) FROM orders GROUP BY user_id; CREATE UNIQUE INDEX ON mv_user_orders(user_id);",{"section":1472,"command":1473,"description":1474,"options":1475,"example":1476},"Transactions","BEGIN \u002F COMMIT \u002F ROLLBACK","Group statements into a single atomic unit of work (ACID).","BEGIN ISOLATION LEVEL SERIALIZABLE; COMMIT\u002FROLLBACK AND CHAIN; SAVEPOINT labels","BEGIN ISOLATION LEVEL REPEATABLE READ; UPDATE orders SET ... WHERE ...; ROLLBACK ON ERROR; COMMIT;",{"section":1472,"command":1478,"description":1479,"options":1480,"example":1481},"SELECT ... FOR UPDATE \u002F FOR SHARE","Lock selected rows until the transaction ends; prevents concurrent updates.","FOR UPDATE \u002F SHARE; NOWAIT or SKIP LOCKED for queues","SELECT id FROM jobs WHERE status='queued' ORDER BY id LIMIT 1 FOR UPDATE SKIP LOCKED;",{"section":1483,"command":1484,"description":1485,"options":1486,"example":1487},"Backup & Restore","pg_dump \u003Cdb> -Fc -f \u003Cfile.dump>","Dump a database to a custom-format file (parallel restore, selective).","-Fc custom; -Ft tar; -Fp plain SQL; --schema=; --exclude-table=; -j jobs for -Fd","pg_dump -Fc -d app -f \u002Fbackup\u002Fapp-$(date +%F).dump",{"section":1483,"command":1489,"description":1490,"options":1491,"example":1492},"pg_restore -d \u003Cdb> \u003Cfile.dump>","Restore a custom\u002Ftar\u002Fdir dump; only the schema\u002Fdata\u002Froles needed.","--clean drop objects first; --if-exists; --schema=; --table=; --jobs=N; --no-owner; --single-transaction","pg_restore -d app_dev --clean --if-exists --jobs=4 \u002Fbackup\u002Fapp.dump",{"section":1483,"command":1494,"description":1495,"example":1496},"psql -d \u003Cdb> -f \u003Cfile.sql>","Restore a plain-SQL dump (output of pg_dump -Fp).","psql -U app -d app_new -v ON_ERROR_STOP=1 -f \u002Fbackup\u002Fapp.sql",{"section":1498,"command":1499,"description":1500,"options":1501,"example":1502},"User & Permission","CREATE ROLE \u002F ALTER ROLE","Roles can log in (LOGIN) and own objects; grant attributes per role.","LOGIN|REPLICATION|INHERIT|NOSUPERUSER; VALID UNTIL '2026-12-31'; PASSWORD '...'","CREATE ROLE reporting LOGIN PASSWORD '...' NOSUPERUSER NOCREATEDB; ALTER ROLE app SET statement_timeout = '5s' ",{"section":1498,"command":1504,"description":1505,"options":1506,"example":1507},"GRANT \u002F REVOKE","Grant privileges on tables, schemas, databases, functions; column-level possible.","GRANT SELECT, INSERT ON TABLE ...; GRANT USAGE ON SCHEMA ...; WITH GRANT OPTION","GRANT SELECT ON ALL TABLES IN SCHEMA public TO reporting;",{"section":1498,"command":1509,"description":1510,"options":1511,"example":1512},"\\dt \u003Cschema>.* \u002F pg_hba.conf","Tweak search_path and visible objects (\\dt public.*); pg_hba.conf controls who can connect.","SHOW search_path; ALTER ROLE app IN DATABASE app SET search_path = app, public; pg_hba.conf hostssl all all 0.0.0.0\u002F0 scram-sha-256","ALTER ROLE app SET search_path = app, public;",{"title":1514,"description":1515,"commands":1516},"MySQL Commands Cheat Sheet","Quick reference for MySQL \u002F MariaDB: client commands, DDL\u002FDML statements, joins\u002Faggregates, indexes, transactions and backup\u002Frestore — with common options and practical examples.",[1517,1522,1527,1533,1538,1542,1547,1552,1556,1560,1564,1568,1573,1577,1582,1587,1591,1596,1601,1606,1611,1616,1619,1624,1628,1632,1637,1642,1646,1650,1655,1660,1665,1670,1675,1679,1684,1690],{"section":1336,"command":1518,"description":1519,"options":1520,"example":1521},"mysql -h \u003Chost> -P \u003Cport> -u \u003Cuser> -p \u003Cdb>","Open an interactive MySQL client session.","-h host; -P 3306 default; -u user; -p password; -D db; -e cmd; -f force continue; --safe-updates","mysql -h mysql.internal -u app -p app_production",{"section":1336,"command":1523,"description":1524,"options":1525,"example":1526},"mysql -u root -p -e \"SHOW DATABASES;\"","Run one or more SQL statements from the shell without entering the REPL.","--tee file capture output; --html html format; --table tab-separated","mysql -u root -p -e \"SHOW SLAVE STATUS\\G\"",{"section":1528,"command":1529,"description":1530,"options":1531,"example":1532},"Meta & Info","SHOW DATABASES","List all databases visible to the user.","SHOW SCHEMAS is a synonym","SHOW DATABASES LIKE 'app%';",{"section":1528,"command":1534,"description":1535,"options":1536,"example":1537},"SHOW TABLES \u002F DESCRIBE","List tables in the current db; DESCRIBE columns of a single table.","SHOW FULL TABLES; DESCRIBE t; SHOW COLUMNS FROM t","SHOW FULL TABLES WHERE Table_type != 'BASE TABLE';",{"section":1528,"command":1539,"description":1540,"example":1541},"SHOW CREATE TABLE \u003Ct>","Print the exact statement that recreates the table — handy for migrations.","SHOW CREATE TABLE orders\\G",{"section":1528,"command":1543,"description":1544,"options":1545,"example":1546},"EXPLAIN \u003Cstatement>","Show the query plan and index usage. Prefix with FORMAT=JSON for tooling.","EXPLAIN FORMAT=JSON; EXPLAIN ANALYZE (MySQL 8.0+) runs the query; EXTENDED\u002Ftraditional deprecated","EXPLAIN SELECT * FROM orders WHERE user_id = 42 ORDER BY created_at DESC LIMIT 10;",{"section":1528,"command":1548,"description":1549,"options":1550,"example":1551},"SHOW STATUS \u002F SHOW VARIABLES","Inspect server health counters and tunable variables.","SHOW GLOBAL STATUS LIKE 'Threads_running'; SHOW VARIABLES LIKE 'innodb_buffer_pool_size%';","SHOW GLOBAL STATUS LIKE 'Slow_queries';",{"section":1373,"command":1374,"description":1553,"options":1554,"example":1555},"Create a new database with optional character set and collation.","CHARACTER SET utf8mb4; COLLATE utf8mb4_0900_ai_ci; ENCRYPTION 'Y' (8.0.16+)","CREATE DATABASE app_dev CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;",{"section":1373,"command":1557,"description":1558,"options":1559,"example":1382},"USE \u003Cdb> \u002F DROP DATABASE \u003Cdb>","Switch the default database or drop an existing one.","USE empties the last result and sets DB; DROP DATABASE is unrecoverable",{"section":1388,"command":1389,"description":1561,"options":1562,"example":1563},"Define a new table — columns, keys, defaults and engine options.","ENGINE=InnoDB; DEFAULT CHARSET=utf8mb4; AUTO_INCREMENT=\u003Cn>; KEY\u002FUNIQUE\u002FPRIMARY KEY constraints","CREATE TABLE orders ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, user_id INT UNSIGNED NOT NULL, total DECIMAL(10,2) NOT NULL DEFAULT 0, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, KEY idx_user_created (user_id, created_at) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;",{"section":1388,"command":1394,"description":1565,"options":1566,"example":1567},"Add\u002Frename\u002Fdrop columns and indexes, change engine, set options.","ADD COLUMN; DROP COLUMN; MODIFY\u002FALTER COLUMN; ADD\u002FDROP INDEX; RENAME; ORDER BY; ALGORITHM=INSTANT|INPLACE|COPY","ALTER TABLE orders ADD COLUMN status ENUM('pending','paid','cancelled') NOT NULL DEFAULT 'pending', ADD INDEX idx_status (status);",{"section":1388,"command":1569,"description":1570,"options":1571,"example":1572},"DROP TABLE \u002F TRUNCATE TABLE","Drop a table (CASCADE optional) or empty it fast (resets AUTO_INCREMENT).","DROP TABLE IF EXISTS; TRUNCATE TABLE; FOREIGN_KEY_CHECKS=0 to allow inter-table ops","TRUNCATE TABLE staging.events;",{"section":1388,"command":1574,"description":1575,"example":1576},"RENAME TABLE \u003Ca> TO \u003Cb>","Atomic rename — handy for hot-swap with a shadow table.","RENAME TABLE orders TO orders_old, orders_new TO orders;",{"section":1408,"command":1578,"description":1579,"options":1580,"example":1581},"INSERT INTO \u003Ct> [(cols)] VALUES ...","Insert one or more rows; multi-row INSERT is faster than many single inserts.","INSERT IGNORE; ON DUPLICATE KEY UPDATE (upsert); INSERT ... SELECT; LAST_INSERT_ID()","INSERT INTO orders(user_id, total) VALUES (1, 9.99), (1, 4.50), (2, 19.95);",{"section":1408,"command":1583,"description":1584,"options":1585,"example":1586},"INSERT ... ON DUPLICATE KEY UPDATE","Upsert — update if a unique\u002Fprimary key collides; affected-rows returns 2.","VALUES(col) for old\u002Fnew; LAST_INSERT_ID() trick for auto-increment chain","INSERT INTO counters(id, hits) VALUES (1, 1) ON DUPLICATE KEY UPDATE hits = hits + 1",{"section":1408,"command":1588,"description":1589,"example":1590},"REPLACE INTO ...","Shorthand for delete+insert on a unique-key collision (deprecated pattern).","REPLACE INTO settings(k, v) VALUES ('theme', 'dark')",{"section":1408,"command":1592,"description":1593,"options":1594,"example":1595},"UPDATE \u002F DELETE","Modify or remove rows. Without WHERE, the entire table is affected.","UPDATE ... ORDER BY ... LIMIT n; multi-table UPDATE t1, t2 SET ... WHERE ...; ON DELETE CASCADE","UPDATE orders SET status='paid' WHERE user_id = 42 AND status='pending' ORDER BY created_at LIMIT 100;",{"section":1408,"command":1597,"description":1598,"options":1599,"example":1600},"DELETE ... ORDER BY ... LIMIT N","Slowly delete big chunks of rows to bound undo logs and lock duration.","LIMIT N; REPEAT the loop; consider truncation for all rows","DELETE FROM events WHERE created_at \u003C now() - INTERVAL 30 DAY ORDER BY id LIMIT 5000",{"section":1424,"command":1602,"description":1603,"options":1604,"example":1605},"SELECT ... FROM ... WHERE ... ORDER BY ... LIMIT ... OFFSET ...","Read rows with filter, sort and pagination.","DISTINCT; IN (subquery) \u002F ANY \u002F ALL; BETWEEN; IS NULL; REGEXP; STRAIGHT_JOIN hint","SELECT id, status FROM orders WHERE user_id = 42 AND status IN ('paid','shipped') ORDER BY created_at DESC LIMIT 10 OFFSET 20;",{"section":1424,"command":1607,"description":1608,"options":1609,"example":1610},"GROUP BY ... HAVING ...","Aggregate rows then filter on the result.","sql_mode=ONLY_FULL_GROUP_BY (8.0+); WITH ROLLUP adds grand-total row","SELECT user_id, count(*) AS n, sum(total) AS gmv FROM orders GROUP BY user_id HAVING count(*) >= 3 ORDER BY gmv DESC LIMIT 50;",{"section":1435,"command":1612,"description":1613,"options":1614,"example":1615},"[INNER | LEFT | RIGHT | CROSS] JOIN ... ON ...","Combine rows from multiple tables.","STRAIGHT_JOIN; USING(col); nested-loop\u002Fhash only on MySQL 8.0+; JSON_TABLE","SELECT u.email, count(o.id) FROM users u LEFT JOIN orders o ON o.user_id = u.id GROUP BY u.email ORDER BY count(o.id) DESC;",{"section":1435,"command":1441,"description":1617,"example":1618},"Common Table Expressions — recursive support since 8.0.","WITH RECURSIVE org AS (SELECT id, manager_id, name FROM staff WHERE manager_id IS NULL UNION ALL SELECT s.id, s.manager_id, s.name FROM staff s JOIN org o ON s.manager_id = o.id) SELECT * FROM org;",{"section":1445,"command":1620,"description":1621,"options":1622,"example":1623},"COUNT() \u002F SUM() \u002F AVG() \u002F MIN() \u002F MAX() \u002F GROUP_CONCAT()","Built-in aggregate functions.","COUNT(DISTINCT x); GROUP_CONCAT(col ORDER BY col SEPARATOR ',')","SELECT day(created_at) AS d, sum(total) AS gmv, count(*) AS n FROM orders GROUP BY day(created_at) ORDER BY d DESC LIMIT 7;",{"section":1451,"command":1452,"description":1625,"options":1626,"example":1627},"Add a secondary index to accelerate lookups and ORDER BY.","UNIQUE; FULLTEXT\u002FSPATIAL (storage-engine aware); ON tbl(col, ...) for composite; INVISIBLE flag (8.0+); DESC on key parts","CREATE INDEX idx_user_created ON orders(user_id, created_at DESC) ALGORITHM=INPLACE LOCK=NONE;",{"section":1451,"command":1629,"description":1630,"example":1631},"DROP INDEX \u002F ALTER TABLE ... DROP INDEX","Remove an index. With ALTER TABLE you can add and drop in one statement.","ALTER TABLE orders DROP INDEX idx_user_created;",{"section":1451,"command":1633,"description":1634,"options":1635,"example":1636},"CREATE VIEW \u002F CREATE OR REPLACE VIEW","Stored SELECT; updatable views support INSERT\u002FUPDATE\u002FDELETE under restrictions.","CREATE OR REPLACE; WITH CHECK OPTION enforces WHERE filter on writes; ALGORITHM=MERGE|TEMPTABLE","CREATE OR REPLACE ALGORITHM=MERGE SQL SECURITY INVOKER VIEW v_user_orders AS SELECT user_id, count(*) AS n FROM orders GROUP BY user_id;",{"section":1472,"command":1638,"description":1639,"options":1640,"example":1641},"START TRANSACTION \u002F COMMIT \u002F ROLLBACK","Wrap statements in an ACID unit; default is autocommit (no Tx needed for single statements).","START TRANSACTION WITH CONSISTENT SNAPSHOT; COMMIT; ROLLBACK TO SAVEPOINT","START TRANSACTION; UPDATE ...; ROLLBACK;",{"section":1472,"command":1643,"description":1644,"example":1645},"SET autocommit = 0; SET TRANSACTION ISOLATION LEVEL ...","Disable per-statement autocommit; change isolation: REPEATABLE READ (InnoDB default), READ COMMITTED, READ UNCOMMITTED, SERIALIZABLE.","SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET autocommit = 0;",{"section":1472,"command":1647,"description":1648,"options":1649,"example":1481},"SELECT ... FOR UPDATE \u002F LOCK IN SHARE MODE","Row-level locks for safety under concurrency. NOWAIT\u002FSKIP LOCKED available in 8.0+.","FOR UPDATE NOWAIT \u002F SKIP LOCKED",{"section":1483,"command":1651,"description":1652,"options":1653,"example":1654},"mysqldump -u \u003Cuser> -p \u003Cdb> > dump.sql","Logical backup: emit SQL INSERTs \u002F DDL to a file.","--single-transaction for InnoDB; --routines; --triggers; --no-data schema only; --add-drop-table; --column-statistics=0","mysqldump -u root -p --single-transaction --routines --triggers --events app > \u002Fbackup\u002Fapp-$(date +%F).sql",{"section":1483,"command":1656,"description":1657,"options":1658,"example":1659},"mysql -u root -p \u003Cdb> \u003C dump.sql","Replay a SQL dump into a (target) database.","--force; --auto-rehash; --comments","mysql -u root -p app_new \u003C \u002Fbackup\u002Fapp.sql",{"section":1483,"command":1661,"description":1662,"options":1663,"example":1664},"SOURCE \u002Fpath\u002Fscript.sql","Run a SQL script from inside the REPL.","source ends without terminator needed for the last statement; \\. in the CLI","SOURCE \u002Ftmp\u002Fmigrations\u002F0002_add_index.sql;",{"section":1483,"command":1666,"description":1667,"options":1668,"example":1669},"mysqlbinlog binlog.000001 > incr.sql","Convert binary logs into SQL for point-in-time recovery.","--start-datetime; --stop-datetime; --start-position; --stop-position","mysqlbinlog --start-datetime='2026-07-23 00:00:00' \u002Fvar\u002Flib\u002Fmysql\u002Fbinlog.000123 > \u002Finc.sql",{"section":1498,"command":1671,"description":1672,"options":1673,"example":1674},"CREATE USER \u002F ALTER USER \u002F DROP USER","Manage MySQL accounts.","IDENTIFIED BY '...'; IDENTIFIED WITH caching_sha2_password; WITH MAX_CONNECTIONS 10;","CREATE USER 'reporting'@'%' IDENTIFIED BY 'P@ssw0rd!'; ALTER USER 'app'@'%' PASSWORD EXPIRE NEVER;",{"section":1498,"command":1504,"description":1676,"options":1677,"example":1678},"Object and global privileges; combinations determine effective capabilities.","GRANT SELECT ON app.* TO 'reporting'@'%'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;","GRANT SELECT, INSERT, UPDATE, DELETE ON app.* TO 'app'@'%';",{"section":1498,"command":1680,"description":1681,"options":1682,"example":1683},"FLUSH PRIVILEGES","Reload in-memory grant tables after manual changes (not needed after GRANT statements).","FLUSH HOSTS \u002F LOGS \u002F TABLES","FLUSH PRIVILEGES;",{"section":1685,"command":1686,"description":1687,"options":1688,"example":1689},"Diagnostics","SHOW PROCESSLIST \u002F KILL \u003Cid>","Show running threads; KILL long-running or stuck queries.","SHOW FULL PROCESSLIST gives full SQL; KILL CONNECTION aborts client; KILL QUERY stops query only","SHOW FULL PROCESSLIST\\G; KILL 12345;",{"section":1685,"command":1691,"description":1692,"options":1693,"example":1691},"SHOW ENGINE INNODB STATUS\\G","Detailed InnoDB diagnostics: locks, transactions, buffer pool, history.","PERFORMANCE_SCHEMA queries: SELECT * FROM performance_schema.events_statements_summary_by_digest_by_error;",{"title":1695,"description":1696,"commands":1697},"Redis CLI Cheat Sheet","Quick reference for redis-cli: connection & info, key\u002Fstring commands, hashes, lists, sets, sorted sets, streams, pub\u002Fsub, server management, persistence & replication and diagnostics — with common options and practical examples.",[1698,1704,1709,1714,1719,1724,1729,1735,1739,1743,1748,1754,1759,1763,1769,1773,1777,1782,1787,1792,1796,1802,1806,1810,1816,1821,1827,1832,1836,1842,1847,1852,1857,1862,1866,1871,1876,1880,1886,1891,1895,1900],{"section":1699,"command":1700,"description":1701,"options":1702,"example":1703},"Connection & Info","redis-cli -h \u003Chost> -p \u003Cport> -a \u003Cpwd>","Connect to a Redis server and open an interactive REPL.","-h host; -p 6379; -a password; --user user; --pass password; --tls; --insecure; -n dbnum","redis-cli -h redis.internal -p 6379 --user monitoring --pass ***",{"section":1699,"command":1705,"description":1706,"options":1707,"example":1708},"redis-cli AUTH \u003Cpassword>","Authenticate to the current connection (after opening the REPL).","--user \u003Cuser> && AUTH password; ACL style","redis-cli AUTH my_secret_password",{"section":1699,"command":1710,"description":1711,"options":1712,"example":1713},"redis-cli PING","Send a PING; should reply PONG — basic connectivity \u002F health probe.","any connect option, e.g. -h \u002F -p \u002F --pass; -r repeat; -i interval","redis-cli -h redis -p 6379 -i 5 PING",{"section":1699,"command":1715,"description":1716,"options":1717,"example":1718},"redis-cli INFO [section]","Show server statistics (server \u002F clients \u002F memory \u002F replication \u002F keyspace \u002F stats \u002F …).","INFO [server|clients|memory|stats|replication|keyspace|cluster|commandstats]; --stat simple live counter","redis-cli -h redis INFO memory | head && redis-cli --stat -i 5 -h redis",{"section":1699,"command":1720,"description":1721,"options":1722,"example":1723},"redis-cli CLIENT LIST","List current client connections (id, addr, fd, name, …).","CLIENT LIST; CLIENT GETNAME; CLIENT SETNAME","redis-cli CLIENT LIST | awk '{print $1, $2}' | head",{"section":1699,"command":1725,"description":1726,"options":1727,"example":1728},"redis-cli CLIENT KILL \u003Cid|addr>","Disconnect a client (by id, addr host:port, TYPE \u002F ADDR \u002F USER \u002F LADDR filters).","KILL ADDR ip:port; KILL TYPE normal|master|replica|pubsub; KILL USER username","redis-cli CLIENT KILL ADDR 10.0.1.42:54321 && redis-cli CLIENT LIST | wc -l",{"section":1730,"command":1731,"description":1732,"options":1733,"example":1734},"Key & String","GET \u002F SET \u002F SETEX \u002F SETNX","Read \u002F write string values; SETEX adds TTL, SETNX writes only if missing.","SET key val EX N (TTL seconds) | PX N (ms) | NX\u002FXX; GETEX (Redis 6.2)","redis-cli SET session:42 '{\"user\":42}' EX 3600 NX && redis-cli GET session:42",{"section":1730,"command":1736,"description":1737,"example":1738},"MSET \u002F MGET \u002F MSETNX","Multi-key string operations; MSETNX rejects if any key exists.","redis-cli MSET cache:hit:1 ok cache:hit:2 ok && redis-cli MGET cache:hit:1 cache:hit:2 cache:miss:1",{"section":1730,"command":1740,"description":1741,"example":1742},"INCR \u002F INCRBY \u002F INCRBYFLOAT","Atomic counter operations — perfect for rate limiters & counters.","redis-cli INCR ratelimit:user:42\nredis-cli INCRBY hitcounter:2026-07-23 5\nredis-cli INCRBYFLOAT metric:load 0.05",{"section":1730,"command":1744,"description":1745,"options":1746,"example":1747},"APPEND \u002F STRLEN \u002F DEL \u002F EXISTS","Common string key management: append text, length, single\u002Fmulti delete.","DEL key [key ...]; EXISTS k1 k2 (count of existing); TYPE key","redis-cli APPEND log:42 'request\\n' && redis-cli STRLEN log:42",{"section":1749,"command":1750,"description":1751,"options":1752,"example":1753},"Key & TTL","EXPIRE \u002F PEXPIRE \u002F TTL \u002F PTTL \u002F PERSIST \u002F EXPIREAT","Set \u002F inspect TTLs (seconds vs millis vs absolute Unix time); PERSIST clears.","EXPIRE key seconds; PEXPIRE key ms; EXPIREAT key unix_seconds; NX\u002FXX\u002FGT\u002FLT","redis-cli EXPIRE session:42 300 && redis-cli TTL session:42",{"section":1749,"command":1755,"description":1756,"options":1757,"example":1758},"KEYS pattern \u002F SCAN","KEYS is O(N) and dangerous on large dbs — prefer SCAN with cursor.","SCAN cursor MATCH pattern COUNT N TYPE type; --no-warnings","redis-cli --scan --pattern 'cache:hit:*' | head -20",{"section":1749,"command":1760,"description":1761,"example":1762},"OBJECT ENCODING|HELP|FREQ|IDLETIME|REFCOUNT \u003Ckey>","Inspect internal encoding, memory & last access (debug & RDS-tier tuning).","redis-cli OBJECT ENCODING big:set && redis-cli OBJECT IDLETIME big:set",{"section":1764,"command":1765,"description":1766,"options":1767,"example":1768},"Hash","HSET \u002F HGET \u002F HMSET \u002F HMGET \u002F HGETALL","Store a small object as a hash — great for profiles, configs, sessions.","HSET key f1 v1 f2 v2; HMGET key f1 f2; HSETNX f v set only if missing","redis-cli HMSET user:42 name Alice email a@x.io && redis-cli HGETALL user:42",{"section":1764,"command":1770,"description":1771,"example":1772},"HKEYS \u002F HVALS \u002F HLEN \u002F HEXISTS \u002F HDEL","Navigate and trim a hash: list keys\u002Fvalues, length, presence, deletion.","redis-cli HKEYS user:42 && redis-cli HLEN user:42 && redis-cli HEXISTS user:42 admin",{"section":1764,"command":1774,"description":1775,"example":1776},"HINCRBY \u002F HINCRBYFLOAT","Atomic counter on a hash field — perfect for nested count metrics.","redis-cli HINCRBY orders:2026-07-23 paid_count 1 && redis-cli HINCRBYFLOAT orders:2026-07-23 gmv 19.95",{"section":1778,"command":1779,"description":1780,"example":1781},"List","LPUSH \u002F RPUSH \u002F LPOP \u002F RPOP","Treat a list as a queue (LPUSH\u002FLPOP = FIFO) or stack (LPUSH\u002FRPOP = queue with backoff).","redis-cli RPUSH jobs:queue job1 job2 job3 && redis-cli LPOP jobs:queue",{"section":1778,"command":1783,"description":1784,"options":1785,"example":1786},"LRANGE \u002F LLEN \u002F LINDEX \u002F LSET \u002F LREM","Read\u002Fmanage ranges of a list; LSET requires index; LREM count>0 from head, \u003C0 from tail.","LRANGE key 0 -1 all; LINDEX 0 head; LREM 0 value all; LTRIM start stop keep range","redis-cli LRANGE jobs:queue 0 -1 && redis-cli LTRIM logs:2026-07-23 -1000 -1",{"section":1778,"command":1788,"description":1789,"options":1790,"example":1791},"BLPOP \u002F BRPOP \u002F BRPOPLPUSH","Blocking variants — pop if empty and wait N seconds; safe queue workers.","BLPOP key timeout (seconds, 0 = forever); COUNT option in Redis 6.2+","redis-cli BLPOP jobs:queue 0",{"section":1778,"command":1793,"description":1794,"example":1795},"RPOPLPUSH src dst \u002F LMOVE src dst LEFT|RIGHT (6.2+)","Atomic pop from one side and push to another — secure queue processing.","redis-cli LMOVE jobs:queue jobs:processing RIGHT LEFT",{"section":1797,"command":1798,"description":1799,"options":1800,"example":1801},"Set","SADD \u002F SMEMBERS \u002F SCARD \u002F SISMEMBER","Set operations: membership, size, bulk check (returns 0\u002F1).","SADD k m1 m2 ...; SCARD k; SISMEMBER k m","redis-cli SADD tags:42 redis postgres mongo && redis-cli SCARD tags:42",{"section":1797,"command":1803,"description":1804,"example":1805},"SREM \u002F SPOP \u002F SRANDMEMBER","Remove, pop random (delete) or random pick (keep) — useful for sampling \u002F lottery.","redis-cli SRANDMEMBER lottery:tickets 3 && redis-cli SPOP lottery:tickets 1",{"section":1797,"command":1807,"description":1808,"example":1809},"SINTER \u002F SUNION \u002F SDIFF \u002F SDIFFSTORE","Set algebra — compute intersections, unions, differences; *_STORE writes to a key.","redis-cli SINTER tags:a tags:b tags:c && redis-cli SDIFFSTORE missing:set tags:all tags:42",{"section":1811,"command":1812,"description":1813,"options":1814,"example":1815},"Sorted Set (Zset)","ZADD \u002F ZSCORE \u002F ZRANGE \u002F ZCARD","Store members with scores; ZRANGE works in score (WITHSCORES) or lex order.","ZADD k score m [score m ...]; ZRANGEBYSCORE -inf +inf; ZREVRANGE","redis-cli ZADD lb:game alice 1500 bob 1300 carol 1750 && redis-cli ZRANGE lb:game 0 -1 REV WITHSCORES",{"section":1811,"command":1817,"description":1818,"options":1819,"example":1820},"ZRANGEBYSCORE \u002F ZRANK \u002F ZINCRBY \u002F ZREM","Range\u002Frank\u002Fcounter on zsets — top-N, lower-bound slides, leaderboards.","ZRANGEBYSCORE min max LIMIT offset count; ZREVRANK; ZREM k m [m...]","redis-cli ZADD ratelimit:api 1750731000.123 10.0.1.42 1750731050.456 10.0.1.7 && redis-cli ZREMRANGEBYSCORE ratelimit:api 0 $(date +%s.%N --date='-5 minutes')",{"section":1822,"command":1823,"description":1824,"options":1825,"example":1826},"Pub\u002FSub & Streams","SUBSCRIBE \u002F PSUBSCRIBE \u002F PUBLISH \u002F UNSUBSCRIBE","Realtime pub\u002Fsub on the wire — lightweight broadcast, no persistence.","PSUBSCRIBE news:*; PUBLISH channel msg; PUB\u002FSUB NUMSUB to inspect","redis-cli PSUBSCRIBE 'app.*' & PID=$!; redis-cli PUBLISH app.notice 'red-button pressed'; sleep 0.1; kill $PID",{"section":1822,"command":1828,"description":1829,"options":1830,"example":1831},"XADD \u002F XLEN \u002F XRANGE \u002F XREAD","Stream = append-only log with consumer groups (Redis 5+).","XADD k * f v; XADD k MAXLEN ~ 1000 * f v (capped); XREAD \u002F XREADGROUP; consumer names; XAUTOCLAIM","redis-cli XADD events * user 42 action click && redis-cli XLEN events && redis-cli XRANGE events - +",{"section":1822,"command":1833,"description":1834,"example":1835},"XREAD BLOCK 0 STREAMS k $","Block forever waiting for new entries — pair with consumer groups for worker queues.","redis-cli XGROUP CREATE events grp1 0 MKSTREAM && redis-cli XREADGROUP GROUP grp1 c1 BLOCK 0 COUNT 10 STREAMS events '>'",{"section":1837,"command":1838,"description":1839,"options":1840,"example":1841},"Server Mgmt","FLUSHDB \u002F FLUSHALL [ASYNC]","Wipe the current (FLUSHDB) or all (FLUSHALL) databases. ⚠️ destructive.","FLUSHALL ASYNC; FLUSHDB ASYNC; --no-auth-warning","redis-cli -h dev FLUSHDB",{"section":1837,"command":1843,"description":1844,"options":1845,"example":1846},"DBSIZE \u002F CONFIG GET|SET \u003Ckey>","Inspect key count and runtime configuration (memory limits, appendonly, etc.).","CONFIG GET dir\u002Fsave\u002Fmaxmemory; CONFIG SET maxmemory 1gb; CONFIG REWRITE persist","redis-cli CONFIG SET maxmemory-policy allkeys-lru && redis-cli CONFIG REWRITE",{"section":1837,"command":1848,"description":1849,"options":1850,"example":1851},"SLOWLOG GET|len|reset","Inspect commands exceeding slowlog-log-slower-than (microseconds).","SLOWLOG GET 10; SLOWLOG LEN; SLOWLOG RESET","redis-cli SLOWLOG GET 10 | jq '.[].command'",{"section":1837,"command":1853,"description":1854,"options":1855,"example":1856},"MONITOR","Stream of every command executed by every client — debug only, very expensive.","no extra flags; --bigkeys (best with redis-cli --bigkeys); --memkeys; --latency; --intrinsic-latency","timeout 2 redis-cli MONITOR | grep -E 'EXPIRE|GET.*:42'",{"section":1837,"command":1858,"description":1859,"options":1860,"example":1861},"DEBUG ... \u002F MEMORY USAGE \u003Ckey>","Inspect internals: OBJECT encoding, memory per key (debug-only flags).","MEMORY USAGE key [SAMPLES N]; DEBUG OBJECT-DURATION or DEBUG RELOAD-ALL-COMMANDS (rare)","redis-cli MEMORY USAGE user:42 SAMPLES 5 && redis-cli MEMORY DOCTOR",{"section":1837,"command":1863,"description":1864,"example":1865},"ACL WHOAMI \u002F ACL CAT \u002F ACL GETUSER","ACL debugging (Redis 6+).","redis-cli ACL WHOAMI && redis-cli ACL GETUSER deployer | head -20",{"section":1867,"command":1868,"description":1869,"example":1870},"Persistence","BGSAVE \u002F SAVE \u002F LASTSAVE","Trigger RDB snapshot (BGSAVE = fork+async); LASTSAVE returns last snapshot timestamp.","redis-cli BGSAVE && redis-cli LASTSAVE",{"section":1867,"command":1872,"description":1873,"options":1874,"example":1875},"BGREWRITEAOF","Rewrite the AOF file in the background (compaction).","Rewrite still blocks briefly; auto is triggered by auto-aof-rewrite-percentage","redis-cli BGREWRITEAOF && redis-cli INFO persistence | head",{"section":1867,"command":1877,"description":1878,"example":1879},"REPLICAOF host port (was SLAVEOF)","Make this instance a replica of another (or REPLICAOF NO ONE to promote).","redis-cli REPLICAOF redis-master 6379 && redis-cli REPLICAOF NO ONE",{"section":1881,"command":1882,"description":1883,"options":1884,"example":1885},"Pipeline & Scanning","redis-cli ... \u003C commands.txt","Pipelining: pipe commands from stdin to a single round-trip — much faster for batch.","--pipe mode uses RESP; \u003C file.txt","printf 'SET k1 v1\\nSET k2 v2\\nGET k1\\nGET k2\\nINCR counter\\n' | redis-cli --pipe | head",{"section":1881,"command":1887,"description":1888,"options":1889,"example":1890},"redis-cli --scan --pattern '...'","Server-side cursor scan, no O(N) blow-up like KEYS.","--scan --pattern p; --bigkeys \u002F --memkeys \u002F --hotkeys (sampling)","redis-cli --scan --pattern 'session:*' | wc -l",{"section":1685,"command":1892,"description":1893,"example":1894},"redis-cli --bigkeys \u002F --memkeys","Find the largest keys \u002F per-key memory; sample-based (won't freeze the server).","redis-cli -h prod --bigkeys --i 0.01 | tee \u002Ftmp\u002Fbigkeys.log",{"section":1685,"command":1896,"description":1897,"options":1898,"example":1899},"redis-cli --latency \u002F --latency-history","Live latency histogram (min \u002F max \u002F avg) over a few samples.","--latency; --latency-history -i 5; --intrinsic-latency N (diagnose the OS clock)","redis-cli -h prod --latency-history -i 5 > \u002Ftmp\u002Flat.log & sleep 30; kill %1",{"section":1685,"command":1901,"description":1902,"example":1903},"redis-cli CLUSTER INFO \u002F CLUSTER NODES","Cluster state: slots, node role (master\u002Freplica), state.","redis-cli --cluster check 10.0.0.1:6379",{"title":1905,"description":1906,"commands":1907},"MongoDB (mongosh) Cheat Sheet","Quick reference for mongosh: connect, CRUD, query operators, aggregation pipeline, indexes, replica sets, users and dump\u002Frestore — with the most common shell patterns and practical examples.",[1908,1914,1918,1923,1929,1934,1939,1945,1949,1954,1959,1964,1968,1972,1976,1982,1986,1990,1996,2000,2005,2009,2014,2018,2024,2029,2034,2040,2045,2050],{"section":1909,"command":1910,"description":1911,"options":1912,"example":1913},"Connect & Meta","mongosh \"\u003Curi>\"","Connect to MongoDB using a standard connection URI.","--quiet; --eval 'cmd'; --file script.js; --apiVersion 1\u002F2","mongosh \"mongodb:\u002F\u002Fapp:PASSWORD@mongo.internal:27017\u002Fapp_production?authSource=admin\"",{"section":1909,"command":1915,"description":1916,"example":1917},"show dbs \u002F use \u003Cdb> \u002F show collections","List databases; switch to one; list collections in the current db.","show dbs | use app | show collections",{"section":1909,"command":1919,"description":1920,"options":1921,"example":1922},"db.serverStatus() \u002F db.stats()","Server info: connections, opcounters, replication state; db stats: size & collections.",".pretty() to pretty-print; .verbose(); .json; --eval result","db.serverStatus().connections && db.stats().dataSize",{"section":1924,"command":1925,"description":1926,"options":1927,"example":1928},"CRUD: Read","db.\u003Ccoll>.find()","Query a collection; chain .pretty() .limit() .skip() .sort() to shape the result.",".projection({name:1, email:1, _id:0}); .sort({createdAt:-1}); .limit(20); .skip(20); .count(); .allowDiskUse()","db.orders.find({status:'paid', amount:{$gte:10}}).sort({createdAt:-1}).limit(20).pretty()",{"section":1924,"command":1930,"description":1931,"options":1932,"example":1933},"db.\u003Ccoll>.findOne({...}) \u002F db.\u003Ccoll>.countDocuments({...})","Read a single document, or count docs matching a filter.","findOne with\u002Fwithout filter; estimatedDocumentCount is O(1)","db.users.findOne({email:'alice@example.com'}, {pwd:0, _id:0}) && db.orders.countDocuments({status:'paid'})",{"section":1935,"command":1936,"description":1937,"example":1938},"CRUD: Create","db.\u003Ccoll>.insertOne({...}) \u002F insertMany([...])","Insert one or many documents; options: ordered:false writes all valid docs even if one fails.","db.logs.insertMany([{k:'api', t:new Date()}, {k:'worker', t:new Date()}], {ordered:false})",{"section":1940,"command":1941,"description":1942,"options":1943,"example":1944},"CRUD: Update","db.\u003Ccoll>.updateOne(filter, update, opts)","Update one document. Use operators like $set $inc $push $pull $addToSet $rename $unset.","upsert:true; arrayFilters:[] for nested arrays; returnDocument:'after' (findOneAndUpdate)","db.users.updateOne({email:'alice@example.com'}, {$inc:{loginCount:1}, $set:{lastSeen:new Date()}}, {upsert:true})",{"section":1940,"command":1946,"description":1947,"example":1948},"db.\u003Ccoll>.updateMany(filter, update) \u002F findOneAndUpdate","Update many docs (write is bulk); findOneAndUpdate returns the doc pre\u002Fpost update atomically.","db.orders.updateMany({status:'pending', createdAt:{$lt:new Date(Date.now()-864e5)}}, {$set:{status:'cancelled'}})",{"section":1950,"command":1951,"description":1952,"example":1953},"CRUD: Replace","db.\u003Ccoll>.replaceOne(filter, replacement)","Replace entire document except _id (not allowed in replacement).","db.users.replaceOne({email:'a@x.io'}, {name:'Alice', email:'a@x.io', role:'admin', tags:['vip']})",{"section":1955,"command":1956,"description":1957,"example":1958},"CRUD: Delete","db.\u003Ccoll>.deleteOne \u002F deleteMany(filter)","Remove docs matching the filter. deleteMany({}) deletes everything (used with caution).","db.sessions.deleteMany({lastSeen:{$lt:new Date(Date.now()-7*864e5)}}) && db.orders.deleteOne({_id:ObjectId('...')})",{"section":1960,"command":1961,"description":1962,"example":1963},"Query Operators","Comparison: $eq \u002F $ne \u002F $gt \u002F $gte \u002F $lt \u002F $lte \u002F $in \u002F $nin","The standard comparison operators; $in matches a list of values.","db.orders.find({amount:{$gte:10,$lt:100}, status:{$in:['paid','shipped']}})",{"section":1960,"command":1965,"description":1966,"example":1967},"Logical: $and \u002F $or \u002F $not \u002F $nor","Combine predicates; $not is regex\u002Fmetadata only, regex needs explicit regex.","db.products.find({$or:[{sale:true,price:{$lt:50}},{tags:'vip'}]})",{"section":1960,"command":1969,"description":1970,"example":1971},"$exists \u002F $type \u002F $regex \u002F $expr \u002F $mod","Field-level predicate: presence, BSON type, regex match, aggregation comparison ($expr), $mod.","db.users.find({email:{$exists:true, $regex:'@example.com$', $options:'i'}})",{"section":1960,"command":1973,"description":1974,"example":1975},"db.\u003Ccoll>.distinct(field, filter)","Get unique values in a field (with optional filter).","db.orders.distinct('userId', {status:'paid'}).length",{"section":1977,"command":1978,"description":1979,"options":1980,"example":1981},"Aggregation",".aggregate([...])","Build a pipeline of stages: $match → $group → $project → $sort → $limit → $lookup → $unwind → $facet.",".explain('executionStats'); allowDiskUse:true; collation document","db.orders.aggregate([ { $match:{status:'paid'} }, { $group:{_id:'$userId', gmv:{$sum:'$amount'}, n:{$sum:1}} }, { $sort:{gmv:-1} }, { $limit:50} ])",{"section":1977,"command":1983,"description":1984,"example":1985},"$lookup \u002F $graphLookup","Join across collections ($lookup) and recursive tree walks ($graphLookup).","db.orders.aggregate([{$lookup:{from:'users', localField:'userId', foreignField:'_id', as:'user'}}, {$unwind:'$user'}, {$project:{total:1, 'user.name':1}}])",{"section":1977,"command":1987,"description":1988,"example":1989},"$bucket \u002F $bucketAuto \u002F $sample \u002F $sortByCount","Useful aggregators: bucketing, sampling, top-N counting.","db.events.aggregate([{$sample:{size:100}}, {$group:{_id:'$kind', n:{$sum:1}}}])",{"section":1991,"command":1992,"description":1993,"options":1994,"example":1995},"Indexes","db.\u003Ccoll>.createIndex(spec, opts)","Create single\u002Fcomposite\u002Fgeospatial\u002Ftext\u002FTTL indexes.","{unique:true, partialFilterExpression, sparse, expireAfterSeconds, weights, name}","db.users.createIndex({email:1}, {unique:true}) && db.events.createIndex({ts:1}, {expireAfterSeconds:7*86400}) && db.shops.createIndex({loc:'2dsphere'})",{"section":1991,"command":1997,"description":1998,"example":1999},"db.\u003Ccoll>.getIndexes() \u002F dropIndex \u002F dropIndexes","List indexes; remove one \u002F all (sometimes: just don't call this in prod!).","db.users.getIndexes().forEach(i=>print(i.name, JSON.stringify(i.key)))",{"section":1991,"command":2001,"description":2002,"options":2003,"example":2004},"db.\u003Ccoll>.explain('executionStats').find(filter)","Inspect the winning plan & actual execution stats. Look for COLLSCAN, IXSCAN, FETCH, sort stage.","executionStats \u002F queryPlanner \u002F allPlansExecution; verbosity","db.orders.find({userId:42,createdAt:{$gte:new Date('2026-01-01')}}).sort({createdAt:-1}).explain('executionStats').queryPlanner.winningPlan",{"section":1991,"command":2006,"description":2007,"example":2008},"db.\u003Ccoll>.hint({...})","Force the planner to use a particular index — debug bad plans, plan regressions.","db.users.find({email:'a@x.io'}).hint({email:1}).explain()",{"section":2010,"command":2011,"description":2012,"example":2013},"Maintenance","db.runCommand({...}) \u002F db.adminCommand \u002F db.command","Run MongoDB commands directly. escape for operations not in the shell helper.","db.runCommand({listCollections:1, name:'app'}) && db.adminCommand({listDatabases:1}).databases.length",{"section":2010,"command":2015,"description":2016,"example":2017},"db.revokeRolesFromUser \u002F grantRolesToUser","Role management (run on admin DB).","use admin; db.createUser({user:'audit',pwd:'...',roles:[{role:'readAnyDatabase',db:'admin'}]})",{"section":2019,"command":2020,"description":2021,"options":2022,"example":2023},"Replica Set","rs.initiate() \u002F rs.status()","Bootstrap a single-node replica set; show health.","rs.initiate({_id:'rs0',members:[{_id:0,host:'m1:27017'}]}); rs.status().myState","rs.initiate({_id:'rs0',members:[{_id:0,host:'m1:27017'},{_id:1,host:'m2:27017'},{_id:2,host:'m3:27017'}]})",{"section":2019,"command":2025,"description":2026,"options":2027,"example":2028},"rs.add \u002F rs.remove \u002F rs.stepDown","Add \u002F remove members; force election to test failover.","rs.add('m4:27017'); rs.remove('m3:27017'); rs.stepDown(60)","rs.add('m4.internal:27017') && rs.stepDown(60) && sh.status() on the next member",{"section":2030,"command":2031,"description":2032,"example":2033},"Sharded Cluster","sh.status() \u002F sh.enableSharding","Inspect the cluster topology \u002F enable sharding on a database.","use admin; sh.enableSharding('analytics'); sh.shardCollection('analytics.events', {userId:1, ts:1})",{"section":2035,"command":2036,"description":2037,"options":2038,"example":2039},"Backup & Migration","mongodump \u002F mongorestore","Logical backup \u002F restore. Use --uri, --db, --archive to stream; --gzip for compressed.","--gzip; --archive=file.archive; --oplog for point-in-time; --nsInclude\u002FExclude","mongodump --uri=\"mongodb:\u002F\u002Fuser:pw@m1:27017\u002F?authSource=admin\" --gzip --archive=\u002Fbackup\u002Fapp-2026-07-23.archive && mongorestore --gzip --archive=\u002Fbackup\u002Fapp.archive --nsInclude='app.*' --drop",{"section":2035,"command":2041,"description":2042,"options":2043,"example":2044},"mongoexport \u002F mongoimport","Export \u002F import JSON or CSV. Stays as a separator engine for piping between Mongo and other systems.","--type=json|csv; --fields=a,b,c; --headerline; -q filter; --jsonArray (single top-level array)","mongoexport --uri=\"...\" -d app -c orders --type=json -q '{\"status\":\"paid\"}' --out=orders.json && mongoimport --drop --jsonArray orders.json -d copy -c orders",{"section":2035,"command":2046,"description":2047,"options":2048,"example":2049},"mongotop \u002F mongostat","Live monitoring: how much time each collection spent on read\u002Fwrite in the last second; statistics.","interval in seconds; --host","mongostat --host=m1.internal --authdb=admin --username=ops -i 5",{"section":2035,"command":2051,"description":2052,"options":2053,"example":2054},"db.shutdownServer()","Run on admin DB to stop mongod cleanly — also useful after rm\u002Fpoweroff to recover.","use admin; db.shutdownServer({force:true}? No; clean shutdown waits for oplog replication)","use admin; db.shutdownServer()",{"title":2056,"description":2057,"commands":2058},"pnpm Cheat Sheet","Quick reference for pnpm: install \u002F add \u002F remove \u002F update, scripts, workspaces, store & cache and config — focused on the GitHub-site pnpm repo workflow, with options and practical examples.",[2059,2065,2070,2075,2080,2085,2090,2095,2100,2105,2110,2115,2120,2126,2131,2136,2141,2147,2152,2157,2163,2167,2172,2178,2183,2188,2193,2199,2204,2209,2214],{"section":2060,"command":2061,"description":2062,"options":2063,"example":2064},"Install & Manage","pnpm install","Install all dependencies declared in package.json, updating the lockfile as needed.","--frozen-lockfile (CI default in this repo); --prod; --offline; --ignore-scripts; --shamefully-hoist; --strict-peer-dependencies=false; --prefer-offline","pnpm install --frozen-lockfile",{"section":2060,"command":2066,"description":2067,"options":2068,"example":2069},"pnpm add \u003Cpkg>","Add a runtime dependency and write to package.json.","-D \u002F --save-dev; -E \u002F --save-exact; -O \u002F --save-optional; -P \u002F --save-prod; -g global; --workspace-root add at workspace root","pnpm add -D vitest @types\u002Fnode",{"section":2060,"command":2071,"description":2072,"options":2073,"example":2074},"pnpm add -g \u003Cpkg>","Install a global tool (e.g. TypeScript, ESLint, tsx) onto the path.","-g; --global-prefix; --reporter append|ndjson","pnpm add -g typescript tsx",{"section":2060,"command":2076,"description":2077,"options":2078,"example":2079},"pnpm remove \u003Cpkg>","Remove a dependency from the project and the lockfile.","-D from devDependencies; -g from globals; --filter pkg remove from one workspace only","pnpm remove lodash && pnpm remove -F web -D @types\u002Fjest",{"section":2060,"command":2081,"description":2082,"options":2083,"example":2084},"pnpm update \u002F pnpm update -L","Update dependencies within the semver range; -L \u002F --latest upgrades to the newest version.","-L \u002F --latest; -i \u002F --interactive; --workspace-root; --filter","pnpm update -i vue && pnpm update -L @nuxt\u002Fi18n",{"section":2060,"command":2086,"description":2087,"options":2088,"example":2089},"pnpm outdated","Show outdated packages alongside current \u002F wanted \u002F latest versions.","--long; --recursive \u002F -r; --filter","pnpm outdated -r --long",{"section":2060,"command":2091,"description":2092,"options":2093,"example":2094},"pnpm list","List installed packages and a tree of what depends on them.","--depth 0 only direct; --prod \u002F --dev; -r recursive; --json | jq","pnpm list --depth 0 --prod | head -20",{"section":2060,"command":2096,"description":2097,"options":2098,"example":2099},"pnpm audit \u002F pnpm audit --fix","Run the npm-style security advisory check against the lockfile.","--prod only production; --json","pnpm audit --json | jq '.metadata.vulnerabilities'",{"section":2060,"command":2101,"description":2102,"options":2103,"example":2104},"pnpm dedupe","Prune the lockfile\u002Fdependency tree by hoisting to a single version where possible.","--check; --strict-peer-dependencies=false","pnpm dedupe --check",{"section":2060,"command":2106,"description":2107,"options":2108,"example":2109},"pnpm rebuild","Rebuild native dependencies (post-build \u002F after Node version bump).","--reporter; --recursive; --filter","pnpm rebuild -r && pnpm rebuild esbuild",{"section":2060,"command":2111,"description":2112,"options":2113,"example":2114},"pnpm approve-builds","Approve build scripts for native packages (e.g. esbuild, sharp, @swc\u002Fcore).","interactive prompts; can also be set via package.json#pnpm.onlyBuiltDependencies","pnpm approve-builds --yes esbuild @parcel\u002Fwatcher",{"section":2060,"command":2116,"description":2117,"options":2118,"example":2119},"pnpm import","Import an existing package-lock.json \u002F yarn.lock into a pnpm-lock.yaml.","import; n\u002Fa other params","pnpm import --no-lockfile",{"section":2121,"command":2122,"description":2123,"options":2124,"example":2125},"Run & DX","pnpm run \u003Cscript>","Run a script defined in package.json#scripts.","-r \u002F --recursive run in every package; --filter \u002F -F target one; --parallel; --no-color","pnpm run dev && pnpm -F src\u002Fwww run build",{"section":2121,"command":2127,"description":2128,"options":2129,"example":2130},"pnpm dlx \u003Cpkg>","Fetch a package from the registry and run its binary without permanently installing.","dlx pkg args; --package extra pkg; --silent","pnpm dlx create-vite@latest my-app --template vue-ts && pnpm dlx vitest --run",{"section":2121,"command":2132,"description":2133,"options":2134,"example":2135},"pnpm exec \u003Ccmd>","Run a command in the project's context (PATH includes .node_modules\u002F.bin).","exec ...; --filter target workspace; --recursive; --parallel","pnpm exec vitest run && pnpm exec -- tsc --noEmit -p src\u002Fwww\u002Ftsconfig.json",{"section":2121,"command":2137,"description":2138,"options":2139,"example":2140},"pnpm create \u003Cname>","Scaffold a new project from a create-* style package.","create [name] [args]; -y \u002F --yes","pnpm create nuxt my-app && cd my-app && pnpm install",{"section":2142,"command":2143,"description":2144,"options":2145,"example":2146},"Workspace","pnpm -r \u003Ccmd>","Recursive — run a pnpm action across every package in the workspace.","-r run build; --parallel; --topology sort; --order","pnpm -r --filter \".\u002Fpackages\u002F**\" run build --silent",{"section":2142,"command":2148,"description":2149,"options":2150,"example":2151},"pnpm --filter \u003Cpkg>","Target one package by name, directory, glob or .\u002Frelative-path.","--filter pkg | --filter .\u002Fpackages\u002Ffoo | --filter {pkg} strict name only; -F alias","pnpm --filter trowsoft-pdf-merge run build && pnpm -F \".\u002Fpackages\u002Ftools\u002F*\" outdated",{"section":2142,"command":2153,"description":2154,"options":2155,"example":2156},"pnpm add ... -w \u002F --workspace-root","Add a hoisted dev dependency that's shared across the workspace.","-w \u002F --workspace-root; -D to devDeps","pnpm add -Dw typescript",{"section":2158,"command":2159,"description":2160,"options":2161,"example":2162},"Store & Cache","pnpm store path","Print the location of pnpm's content-addressable store (deduped across projects).","store path; --virtual-store-dir DIR","pnpm store path && du -sh $(pnpm store path)",{"section":2158,"command":2164,"description":2165,"options":2166,"example":2164},"pnpm store prune","Remove unreferenced packages from the store (reduces disk usage).","store prune; --force skip prompt",{"section":2158,"command":2168,"description":2169,"options":2170,"example":2171},"pnpm cache list \u002F cache delete","List or delete entries in pnpm's metadata cache.","cache list; cache delete \u003Cpkg>@\u003Cver>; --registry","pnpm cache list vitest@latest",{"section":2173,"command":2174,"description":2175,"options":2176,"example":2177},"Config & Info","pnpm config get|set \u003Ckey> [value]","Read or write to the user's\u002Fglobal\u002Fstore\u002Fproject pnpm config.","config get key; config set key val; --location project|user|global","pnpm config set registry https:\u002F\u002Fregistry.npmjs.org\u002F --location user && pnpm config get registry",{"section":2173,"command":2179,"description":2180,"options":2181,"example":2182},"pnpm config delete|list","List all effective config keys, or delete one.","config list --location project; config delete key","pnpm config list --location project",{"section":2173,"command":2184,"description":2185,"options":2186,"example":2187},"pnpm why \u003Cpkg>","Explain why a package is in node_modules — show the chain of dependants.","--prod; --dev; -r; --filter","pnpm why -r vue && pnpm why lodash -r",{"section":2173,"command":2189,"description":2190,"options":2191,"example":2192},"pnpm link \u002F pnpm link --global","Symlink a local package into the current project, or install a global package locally.","link (uses .\u002F); link --global \u003Cpkg>; --dir","cd packages\u002Ftools\u002Ffoo && pnpm link --global && cd my-app && pnpm link --global foo",{"section":2194,"command":2195,"description":2196,"options":2197,"example":2198},"Publish & Pack","pnpm publish","Publish the current package to the configured registry.","--dry-run; --tag alpha|beta|next; --access public|restricted; --otp N; --filter","pnpm publish --dry-run --tag canary --access public",{"section":2194,"command":2200,"description":2201,"options":2202,"example":2203},"pnpm pack","Create a tarball of the package without publishing (for upload elsewhere).","--pack-gzip-level 0..9; --pack-destination DIR","pnpm pack --pack-destination .\u002Frelease",{"section":2205,"command":2206,"description":2207,"example":2208},"Recurring Workflows","pnpm recursive list \u002F pnpm -r why","Inspect the dependency tree across all workspaces at once.","pnpm recursive list --depth 0",{"section":2205,"command":2210,"description":2211,"options":2212,"example":2213},"pnpm run --filter \u003Cpkg> test","Run a script in just one workspace — perfect for fine-grained CI.","--filter with dependencies\u002Fdependents; --parallel","pnpm --filter \"trowsoft-pdf-*\" run build --parallel",{"section":2205,"command":2215,"description":2216,"example":2217},"pnpm sync:tools \u002F pnpm build:tools","Repo helpers from this site — sync tool translations into the Nuxt app, then build tool bundles.","pnpm sync:tools && pnpm build:tools",{"title":2219,"description":2220,"commands":2221},"SSH & OpenSSH Cheat Sheet","Quick reference for OpenSSH: connections, key management, the user config file, file transfer (scp\u002Frsync\u002Fsshfs), port forwarding and jump hosts — with common options and practical examples.",[2222,2227,2231,2236,2241,2246,2251,2256,2261,2266,2272,2277,2282,2287,2292,2297,2303,2309,2314,2319,2324,2330,2335,2339,2343,2349],{"section":1336,"command":2223,"description":2224,"options":2225,"example":2226},"ssh \u003Cuser>@\u003Chost>","Open an interactive SSH session on a remote host.","-p PORT; -i identity_file; -l user (overrides user@); -E logfile debug; -v \u002F -vv \u002F -vvv verbose levels","ssh -p 2222 deploy@bastion.example.com",{"section":1336,"command":2228,"description":2229,"example":2230},"ssh \u003Cuser>@\u003Chost> '\u003Ccmd>'","Run a single non-interactive command on the remote host.","ssh ops@db1 'sudo systemctl status postgresql'",{"section":1336,"command":2232,"description":2233,"options":2234,"example":2235},"ssh -J \u003Cjumphost>","Route the SSH connection through a jump host (ProxyJump).","-J user1@jump1:2222,user2@jump2; -o ProxyCommand=ssh -W ...","ssh -J ops@bastion.internal db1.private -i ~\u002F.ssh\u002Fdb1_key",{"section":1336,"command":2237,"description":2238,"options":2239,"example":2240},"ssh -N -L \u003Cl:r> -f \u003Chost>","Background local port forwarding without opening a shell; -L local:rremote.","-N no remote cmd; -f background; -L 8080:localhost:80; -g allow remote to connect to local side","ssh -N -L 5432:localhost:5432 -f db1 && psql -h localhost",{"section":1336,"command":2242,"description":2243,"options":2244,"example":2245},"ssh -N -R \u003Cr:localhost:l>","Reverse tunnel — open a port on the remote side that forwards back to a local port.","-N; -f; -R 8080:localhost:3000; GatewayPorts yes (server config)","ssh -N -R 8080:localhost:3000 dev@public.example.com",{"section":1336,"command":2247,"description":2248,"options":2249,"example":2250},"ssh -D \u003Clport>","Set up a SOCKS proxy on the local side via the SSH server.","-C compress; -q quiet; -D 1080","ssh -D 1080 -q -N tunnel.example.com && curl --proxy socks5h:\u002F\u002Flocalhost:1080 https:\u002F\u002Fifconfig.me",{"section":1336,"command":2252,"description":2253,"options":2254,"example":2255},"ssh -A \u003Cuser>@\u003Chost>","Forward your local ssh-agent to the remote host (chain SSH through it).","-A agent forward; -a disable","ssh -A ops@bastion && ssh internal-db  # uses your local keys",{"section":1336,"command":2257,"description":2258,"options":2259,"example":2260},"ssh -o \u003Ckey>=\u003Cvalue>","Pass per-invocation SSH options (useful for one-off changes that don't deserve a config entry).","StrictHostKeyChecking=no; UserKnownHostsFile=\u002Fdev\u002Fnull (insecure, demo only); RequestTTY=force","ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=\u002Fdev\u002Fnull test@127.0.0.1",{"section":1336,"command":2262,"description":2263,"options":2264,"example":2265},"ssh -F \u003Cconfigfile>","Use an alternative ssh_config file (handy for per-project \u002F per-customer settings).","-F path; -G parse and print config without connecting","ssh -F ~\u002F.ssh\u002Fconfig.work -G devbox | grep -E 'hostname|user'",{"section":2267,"command":2268,"description":2269,"options":2270,"example":2271},"Keys","ssh-keygen -t ed25519 -C '\u003Cemail>'","Generate a modern, compact ED25519 key pair (preferred over RSA).","-t ed25519|rsa|ecdsa; -b bits; -C comment; -f output_path; -N 'passphrase'; -q quiet","ssh-keygen -t ed25519 -C 'you@work' -f ~\u002F.ssh\u002Fwork_ed25519 -N ''",{"section":2267,"command":2273,"description":2274,"options":2275,"example":2276},"ssh-keygen -lf \u003Cpubkey>","Show the fingerprint and length of a public key (auditing SSH banners).","-E md5|sha256|shake256; -l list; -i read from stdin","ssh-keygen -lf ~\u002F.ssh\u002Fid_ed25519.pub -E sha256",{"section":2267,"command":2278,"description":2279,"options":2280,"example":2281},"ssh-keygen -R \u003Chost>","Remove a host key from known_hosts (after the server is rebuilt \u002F re-keyed).","-R '[host]:port' support non-default port","ssh-keygen -R '[bastion.example.com]:2222'",{"section":2267,"command":2283,"description":2284,"options":2285,"example":2286},"ssh-copy-id \u003Cuser>@\u003Chost>","Install your public key into a remote authorized_keys (password auth required).","-i identity.pub; -p PORT; -o options","ssh-copy-id -i ~\u002F.ssh\u002Fwork_ed25519.pub -p 2222 deploy@bastion",{"section":2267,"command":2288,"description":2289,"options":2290,"example":2291},"ssh-add [path]","Add a private key to the running ssh-agent (so you don't re-type the passphrase).","-l list fingerprints; -D delete all; -d path remove; -t N lifetime","eval $(ssh-agent) && ssh-add ~\u002F.ssh\u002Fwork_ed25519 && ssh-add -l",{"section":2267,"command":2293,"description":2294,"options":2295,"example":2296},"ssh-keyscan \u003Chost>","Print remote host keys (for prebaking into known_hosts \u002F bootstrap).","-t rsa|ed25519|ecdsa; -p PORT","ssh-keyscan -t ed25519 -p 2222 bastion.example.com >> ~\u002F.ssh\u002Fknown_hosts",{"section":2298,"command":2299,"description":2300,"options":2301,"example":2302},"Config File","~\u002F.ssh\u002Fconfig","Per-user SSH config — declare hosts, aliases, identities, jump hosts, keepalives.","Host alias; HostName real; User; Port; IdentityFile; PreferredAuthentications; AddKeysToAgent yes; ServerAliveInterval 30; IdentitiesOnly yes; ProxyJump \u002F ProxyCommand; LocalForward \u002F RemoteForward; ControlMaster auto \u002F ControlPath \u002F ControlPersist","Host bastion\n  HostName bastion.example.com\n  Port 2222\n  User ops\n  IdentityFile ~\u002F.ssh\u002Fwork_ed25519\n\nHost db*\n  ProxyJump bastion\n  User ubuntu",{"section":2304,"command":2305,"description":2306,"options":2307,"example":2308},"File Transfer","scp \u003Csrc> \u003Cdest>","Copy files between hosts over SSH (legacy but ubiquitous).","-r recursive; -P PORT; -i identity; -C compress; -p preserve mode\u002Ftime; -l limit bandwidth (Kbit\u002Fs)","scp -P 2222 -r dist\u002F ops@bastion.example.com:\u002Fsrv\u002Fapp\u002Freleases\u002F1.4.2\u002F",{"section":2304,"command":2310,"description":2311,"options":2312,"example":2313},"rsync -avz -e ssh \u003Csrc> \u003Cdest>","Mirror \u002F copy with delta sync — must faster for repeating transfers of large trees.","-a archive; -v verbose; -z compress; -P partial + progress; --delete mirror; --exclude; --dry-run; -e ssh -p 2222","rsync -avz -e 'ssh -p 2222' .\u002Fbuild\u002F ops@bastion:\u002Fsrv\u002Fapp\u002Fcurrent\u002F",{"section":2304,"command":2315,"description":2316,"options":2317,"example":2318},"sshfs \u003Cuser>@\u003Chost>:\u003Cpath> \u003Cmount>","Mount a remote filesystem over SSH (FUSE) — edit remote files with local tools.","-p PORT; -o reconnect; -o transform_symlinks; -C compress","sshfs ops@bastion:\u002Fsrv\u002Fapp .\u002Fremote -o reconnect,transform_symlinks",{"section":2304,"command":2320,"description":2321,"options":2322,"example":2323},"sftp \u003Cuser>@\u003Chost>","Interactive \u002F scripted file transfers over the SSH subsystem.","sftp -i id -P port; commands: get \u002F put \u002F sync \u002F ls \u002F lls \u002F cd \u002F lcd \u002F chmod","sftp ops@bastion \u003C\u003C'EOF'\nmkdir \u002Fsrv\u002Fapp\u002Freleases\u002F1.4.2\nput -r dist\u002F* \u002Fsrv\u002Fapp\u002Freleases\u002F1.4.2\u002F\nEOF",{"section":2325,"command":2326,"description":2327,"options":2328,"example":2329},"Troubleshooting","ssh -vvv \u003Chost>","Trace the connection: KEX, auth, channel setup. Best for 'why is this failing?'","-v \u002F -vv \u002F -vvv; -E file write to file","ssh -vvv -E \u002Ftmp\u002Fssh.dbg ops@bastion 2>&1 | grep -E 'Authentications|method|Permission denied'",{"section":2325,"command":2331,"description":2332,"options":2333,"example":2334},"ssh-keygen -y -f \u003Cprivate>","Derive the public key from a private key (when you only have the private half).","-f file; -E hash algorithm","ssh-keygen -y -f ~\u002F.ssh\u002Fid_ed25519 > \u002Ftmp\u002Fderived.pub && diff ~\u002F.ssh\u002Fid_ed25519.pub \u002Ftmp\u002Fderived.pub && echo OK",{"section":2325,"command":2336,"description":2337,"example":2338},"ssh -o ConnectTimeout=\u003CN> -o ConnectionAttempts=\u003CK>","Tune connection timeouts \u002F retries for flaky networks or warm jump hosts.","ssh -o ConnectTimeout=5 -o ConnectionAttempts=2 ops@bastion",{"section":2325,"command":2340,"description":2341,"example":2342},"ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=3","Keep idle SSH connections alive through NAT \u002F firewalls.","ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -L 5432:db:5432 -N ops@bastion",{"section":2344,"command":2345,"description":2346,"options":2347,"example":2348},"Trusted Forwarding","ssh -W %h:%p \u003Cproxy>","Use as ProxyCommand for a chained connection — old-style alternative to ProxyJump.","ProxyCommand ssh -W %h:%p myjumphost nc -q0 %h %p","ssh -o ProxyCommand='ssh -W %h:%p bastion.example.com' internal-db",{"section":2010,"command":2350,"description":2351,"options":2352,"example":2353},"ssh -O stop \u002F ssh -M -S \u003Csock>","ControlMaster — share a single SSH session across many terminals for speed.","-M master mode; -S socket path; -O check|forward|exit","ssh -M -S ~\u002F.ssh\u002Fcm-%h bastion; ssh -S ~\u002F.ssh\u002Fcm-%h bastion -O check",{"title":2355,"description":2356,"commands":2357},"curl Cheat Sheet","Quick reference for curl: HTTP verbs, headers, authentication, JSON, forms, uploads, downloads, redirects, debugging, retries, and connection controls — with common options and practical examples.",[2358,2364,2369,2375,2380,2385,2390,2396,2401,2406,2412,2417,2422,2428,2433,2439,2443,2448,2453,2458,2464,2469,2474,2479,2484,2489,2494,2500,2505,2511],{"section":2359,"command":2360,"description":2361,"options":2362,"example":2363},"Basics","curl \u003Curl>","Fetch a URL and print the body to stdout.","-L follow redirects; -i include headers; -I HEAD only; -v verbose; -s silent; -S show errors; --compressed decode gzip\u002Fbrotli","curl -L -s -o website.html https:\u002F\u002Fexample.com && curl -sI https:\u002F\u002Fexample.com",{"section":2359,"command":2365,"description":2366,"options":2367,"example":2368},"curl -O \u003Curl>  \u002F  curl -o \u003Cfile> \u003Curl>","Download a file: -O keeps the remote name, -o writes to a chosen path.","-O; -o file; --create-dirs; --remove-on-error; -C - resume; --retry N; --retry-delay N","curl -O https:\u002F\u002Fnodejs.org\u002Fdist\u002Fv22.17.0\u002Fnode-v22.17.0-linux-x64.tar.xz && curl -C - -O https:\u002F\u002Freleases.example.com\u002Fsqldump.sql",{"section":2370,"command":2371,"description":2372,"options":2373,"example":2374},"HTTP Methods & Headers","curl -X \u003CMETHOD> \u003Curl>","Force a specific HTTP method (POST\u002FPUT\u002FPATCH\u002FDELETE...).","-X POST\u002FPUT\u002FPATCH\u002FDELETE; --request-method; --request-target","curl -X DELETE -s https:\u002F\u002Fapi.example.com\u002Fusers\u002F42 && curl -X POST https:\u002F\u002Fapi.example.com\u002Freset",{"section":2370,"command":2376,"description":2377,"options":2378,"example":2379},"curl -H 'Header: value' \u003Curl>","Send one or more custom headers (Content-Type, X-API-Key, etc.).","-H 'X-API-Key: ...'; -H repeated; --json (Content-Type + payload); --form -F (multipart)","curl -s -H 'Authorization: Bearer $TOKEN' -H 'Accept: application\u002Fjson' https:\u002F\u002Fapi.example.com\u002Forders\u002F1",{"section":2370,"command":2381,"description":2382,"options":2383,"example":2384},"curl -A \u003Cagent> \u002F -e \u003Curl>","Set the User-Agent string or Referer.","-A 'Mozilla\u002F5.0 ...'; -e 'https:\u002F\u002Fgoogle.com'; --referer alias","curl -sA 'Mozilla\u002F5.0 (X11; Linux)' -e 'https:\u002F\u002Fgoogle.com' https:\u002F\u002Fexample.com\u002Farticle",{"section":2370,"command":2386,"description":2387,"options":2388,"example":2389},"curl -i \u002F -D headers.txt \u002F -I \u003Curl>","-i shows headers inline; -D writes them to a file; -I sends HEAD only.","-i; -D \u003Cfile>; -I; --dump-header \u003Cfile>","curl -sI https:\u002F\u002Fapi.example.com\u002Fhealth && curl -D headers.txt -o body.json -s https:\u002F\u002Fapi.example.com\u002Fme",{"section":2391,"command":2392,"description":2393,"options":2394,"example":2395},"Authentication","curl -u \u003Cuser>:\u003Cpassword>","HTTP Basic auth (with optional password; leave out the colon for prompt).","-u user:pass; --basic; -U readonly specific method","curl -u alice:'P@ssw0rd!' -s https:\u002F\u002Frest.example.com\u002Fprivate\u002Flist && curl -u alice -s https:\u002F\u002Frest.example.com\u002Fme",{"section":2391,"command":2397,"description":2398,"options":2399,"example":2400},"curl -H 'Authorization: Bearer \u003Ctoken>'","Send a Bearer token (also works via --oauth2-bearer).","--oauth2-bearer $TOKEN; --bearer alias (8+)","curl --oauth2-bearer '$GH_TOKEN' -s https:\u002F\u002Fapi.github.com\u002Fuser | jq .login",{"section":2391,"command":2402,"description":2403,"options":2404,"example":2405},"curl --cert \u002F --key \u002F --cacert","Use client certificates \u002F CA bundle for mTLS.","--cert certfile[:password]; --key key; --cacert ca.pem; --capath dir","curl --cert client.p12:P@ss --cacert ca.pem -s https:\u002F\u002Fsecure.internal\u002Fapi && curl --cert cert.pem --key key.pem --cacert ca.pem https:\u002F\u002F...",{"section":2407,"command":2408,"description":2409,"options":2410,"example":2411},"Data & Form","curl -d '\u003Cbody>' \u002F -d @file \u002F --data-raw \u002F --data-binary","Send a request body (POST\u002FPUT). -d defaults to form encoding; --data-binary preserves bytes.","-d 'a=b&c=d'; --data-raw; --data-binary @f; -G with --data-urlencode builds a query string","curl -s -X POST -d 'name=alice&email=a@x.io' https:\u002F\u002Fapi.example.com\u002Fusers && curl --data-binary @body.json -H 'Content-Type: application\u002Fjson' https:\u002F\u002Fapi.example.com\u002Fnotes",{"section":2407,"command":2413,"description":2414,"options":2415,"example":2416},"curl -F 'file=@\u002Fpath'","Send a multipart\u002Fform-data upload (the browser's standard upload format).","-F field=value; -F file=@path; -F 'file=@img.png;type=image\u002Fpng'; --form-string raw","curl -s -F 'avatar=@.\u002Fphoto.png' -F 'name=alice' https:\u002F\u002Fapi.example.com\u002Fprofile",{"section":2407,"command":2418,"description":2419,"options":2420,"example":2421},"curl -G --data-urlencode","Build a URL-encoded query string (URL-encode values automatically).","-G --data-urlencode 'q=hello world' --data-urlencode 'limit=10'","curl -sG --data-urlencode 'q=hello world' --data-urlencode 'page=2' https:\u002F\u002Fapi.example.com\u002Fsearch",{"section":2423,"command":2424,"description":2425,"options":2426,"example":2427},"JSON","curl -d @body.json -H 'Content-Type: application\u002Fjson'","Send JSON in the request body.","use --json shortcut (Content-Type + payload in one flag)","curl -s --json @body.json -X POST https:\u002F\u002Fapi.example.com\u002Forders && curl --json '{\"a\":1}' https:\u002F\u002Fapi.example.com\u002Fx",{"section":2423,"command":2429,"description":2430,"options":2431,"example":2432},"curl | jq '.'","Pipe response into jq for readable \u002F filtered JSON.","jq '. | {name,id}'; jq 'select(.id==42)'","curl -s https:\u002F\u002Fapi.github.com\u002Frepos\u002Fpnpm\u002Fpnpm\u002Freleases\u002Flatest | jq '{tag_name: .tag_name, name: .name, assets: [.assets[].name]}'",{"section":2434,"command":2435,"description":2436,"options":2437,"example":2438},"Cookies & Sessions","curl -b cookies.txt \u002F -c cookies.txt","Read cookies (b) \u002F write cookies (c). Pass -j on first call to capture redirects.","-c jar.txt save; -b \"k=v\" literal; -b \u002F -c \u002Ftmp\u002Fjar same file","curl -s -c \u002Ftmp\u002Fjar.txt -o \u002Fdev\u002Fnull https:\u002F\u002Fapp.example.com\u002Flogin && curl -s -b \u002Ftmp\u002Fjar.txt https:\u002F\u002Fapp.example.com\u002Fdashboard",{"section":2434,"command":2440,"description":2441,"example":2442},"curl --cookie-jar \u002F --cookie","Long-form aliases of -c \u002F -b; use these in scripts for clarity.","curl --cookie-jar \u002Ftmp\u002Fjar --cookie \u002Ftmp\u002Fjar -s https:\u002F\u002Fapp.example.com\u002Fme",{"section":1291,"command":2444,"description":2445,"options":2446,"example":2447},"curl -v \u002F -vv \u002F --trace-ascii","Verbose handshake trace; --trace dumps bytes sent\u002Freceived.","-v \u002F -vv \u002F -vvv; --trace-ascii file; --trace file (binary)","curl -v --trace-ascii \u002Ftmp\u002Flogin.trace https:\u002F\u002Fapi.example.com\u002Flogin",{"section":1291,"command":2449,"description":2450,"options":2451,"example":2452},"curl --next","Reset flags between chained requests (avoids 'URL parm 0' and connection leaks).","--next; provides a per-call reset","curl -s -H 'Accept: text\u002Fhtml' https:\u002F\u002Fexample.com --next -s -H 'Accept: application\u002Fjson' https:\u002F\u002Fexample.com\u002Fapi",{"section":1291,"command":2454,"description":2455,"options":2456,"example":2457},"curl -w '%{http_code}\\n'","Define a write-out template — useful in scripts to inspect timing or status.","-w 'status=%{http_code} time=%{time_total}\\n'; --write-out","curl -s -o \u002Fdev\u002Fnull -w 'status=%{http_code} time=%{time_total}s bytes=%{size_download}\\n' https:\u002F\u002Fexample.com\u002Fhealth",{"section":2459,"command":2460,"description":2461,"options":2462,"example":2463},"Transfers & Retries","curl -C - \u003Curl>","Resume a partial download from where it stopped.","-C -; --continue-at -","curl -C - -O https:\u002F\u002Freleases.example.com\u002Fubuntu-iso.iso",{"section":2459,"command":2465,"description":2466,"options":2467,"example":2468},"curl --retry N --retry-delay S --retry-all-errors","Auto-retry transient errors (network, 5xx, reset).","--retry; --retry-delay; --retry-max-time; --retry-connrefused; --retry-all-errors (8+)","curl --retry 5 --retry-delay 5 --retry-all-errors --max-time 60 -O https:\u002F\u002Finternal.example.com\u002Fbig.zip",{"section":2459,"command":2470,"description":2471,"options":2472,"example":2473},"curl --limit-rate \u003Cspeed> \u002F --max-time \u003Cseconds>","Cap the bandwidth usage or absolute run time.","--limit-rate 200k; --max-time 30; --connect-timeout 5","curl --limit-rate 1M --max-time 600 -O https:\u002F\u002Freleases.example.com\u002Fbig.iso",{"section":2459,"command":2475,"description":2476,"options":2477,"example":2478},"curl -T \u003Cfile> \u003Curl>","Upload a file via PUT (or HTTP PUT\u002FRESUMABLE, with -C -).","-T file; --upload-file; continue -C -; combine with -H 'Authorization: ...'","curl -T .\u002Fdist.tar.gz -H 'Authorization: Bearer $TOKEN' https:\u002F\u002Fuploads.example.com\u002Fbuild\u002F1.4.2.tar.gz",{"section":1336,"command":2480,"description":2481,"options":2482,"example":2483},"curl --interface \u003Cip> \u002F --dns-servers","Bind a NIC (use a VPN interface IP) or override DNS — for split DNS debugging.","--interface eth0:0; --dns-servers 1.1.1.1; --resolve 'host:port:ip' overrides per-call","curl --interface 10.99.0.1 -s https:\u002F\u002Fapi.internal.example.com && curl --resolve api.internal.example.com:443:127.0.0.1 -s https:\u002F\u002Fapi.internal.example.com",{"section":1336,"command":2485,"description":2486,"options":2487,"example":2488},"curl --http2 \u002F --http3 \u002F --tlsv1.2","Negotiate a specific protocol or TLS version.","--http2; --http2-prior-knowledge; --http3 (curl ≥ 7.88); --tls-max 1.3; --no-alpn","curl --http3 -sI https:\u002F\u002Fcloudflare-quic.com && curl --tlsv1.2 -s https:\u002F\u002Fapi.example.com",{"section":1336,"command":2490,"description":2491,"options":2492,"example":2493},"curl --insecure \u002F --cacert","Skip or override TLS verification (insecure = debug only).","-k \u002F --insecure; --cacert ca.pem; --capath dir","curl -k --cacert dev-ca.pem -s https:\u002F\u002Flocalhost:8443\u002Fhealth",{"section":2495,"command":2496,"description":2497,"options":2498,"example":2499},"Config","curl -K config.curl","Drive curl from a config file — great for repeatable scripts.","--config file; per-call options","curl -sK - \u003C\u003C'EOF'\\nurl = 'https:\u002F\u002Fapi.example.com\u002Fme'\\nheader = 'Authorization: Bearer '$'${TOKEN}'\\n",{"section":2495,"command":2501,"description":2502,"options":2503,"example":2504},"curl --parallel \u002F --parallel-max","Run multiple URLs concurrently from a single curl instance (curl 7.68+).","--parallel; --parallel-immediate; --parallel-max N","curl --parallel --parallel-max 5 -sO https:\u002F\u002Fexample.com\u002Fimg1.png -sO https:\u002F\u002Fexample.com\u002Fimg2.png",{"section":2506,"command":2507,"description":2508,"options":2509,"example":2510},"Misc","curl --fail-with-body \u002F -f \u002F -fsSL","Common URL-getting idiom for scripts: silent, follow, fail on HTTP errors, output.","-f \u002F --fail; --fail-with-body show body on error; -s silent; -L follow; -S show errors","curl -fsSL -o installer.sh https:\u002F\u002Fget.docker.com && sh installer.sh",{"section":2506,"command":2512,"description":2513,"options":2514,"example":2515},"curl --compressed \u002F --no-compressed","Request gzip, deflate, or brotli with --compressed; saves bandwidth.","--compressed","curl --compressed -s -A 'Mozilla\u002F5.0' https:\u002F\u002Fnews.example.com | head -c 200",{"title":2517,"description":2518,"commands":2519},"Vim Cheat Sheet","Quick reference for Vim \u002F Neovim: modes, cursor motion, editing, search & replace, multi-file navigation, registers \u002F macros and visual-block edits — with short examples for the most common moves.",[2520,2526,2530,2534,2539,2543,2547,2551,2555,2559,2563,2568,2573,2579,2583,2587,2591,2595,2599,2604,2610,2614,2619,2623,2629,2633,2637,2642,2646,2651,2657,2661,2667,2671,2676,2680,2684],{"section":2521,"command":2522,"description":2523,"options":2524,"example":2525},"Modes & Saving",":w \u002F :q \u002F :wq \u002F :q!","Save, quit, save-and-quit, force-quit without saving.",":w file (save as); :w! (force); :x (save & quit if modified); :qa! force-quit all; :wqa",":w | :q   or  ZZ",{"section":2521,"command":2527,"description":2528,"example":2529},"i \u002F a \u002F o \u002F I \u002F A \u002F O","Enter Insert mode: i before \u002F a after cursor; o \u002F O open line below \u002F above; I\u002FA at line end.","i edit here => o new line + insert => I line-beginning => A line-end",{"section":2521,"command":2531,"description":2532,"example":2533},"\u003CEsc> \u002F Ctrl-[","Return to Normal mode (also use Ctrl-c \u002F Ctrl-[). A blink cancel-pending operators.","i Hello\u003CEsc>  ;  then :w",{"section":2535,"command":2536,"description":2537,"example":2538},"Cursor Movement","h \u002F j \u002F k \u002F l","Move one character left \u002F down \u002F up \u002F right. (Arrow keys work too.)","5j  —  move 5 lines down",{"section":2535,"command":2540,"description":2541,"example":2542},"w \u002F b \u002F e \u002F W \u002F B \u002F E","Move by word (PUNCT and BLANKS separated); W\u002FB\u002FE on whitespace-separated words.","wdw   ;   3W to third whitespace-word forward",{"section":2535,"command":2544,"description":2545,"example":2546},"0 \u002F $ \u002F ^","Hard start of line \u002F end of line \u002F first non-blank.","0  to start ; $ to end ; ^ to first non-blank",{"section":2535,"command":2548,"description":2549,"example":2550},"gg \u002F G \u002F :N","First line \u002F last line \u002F jump to line N. Move with percentages: 50%.","gg=G  format the entire file (with =)",{"section":2535,"command":2552,"description":2553,"example":2554},"H \u002F M \u002F L \u002F Ctrl-d \u002F Ctrl-u","Top \u002F middle \u002F bottom of screen (H\u002FM\u002FL); half-page down (Ctrl-d) \u002F up (Ctrl-u).","Ctrl-d and Ctrl-u to scan; 10Ctrl-f full page forward",{"section":2535,"command":2556,"description":2557,"example":2558},"{ \u002F } \u002F ( \u002F )","Jump by paragraph (curly braces) or sentence (parens, ASCII text).","5{   ;   2} to jump two paragraphs forward",{"section":2535,"command":2560,"description":2561,"example":2562},"f\u003Cchar> \u002F F\u003Cchar> \u002F t \u002F T ; ; \u002F ,","Find \u002F reverse-find the next char on the line (f\u002FF); repeat with ; \u002F ,. t\u002FT stop before.","f, brings the cursor to the next comma ; df, deletes through next comma",{"section":2564,"command":2565,"description":2566,"example":2567},"Insert Mode","Ctrl-h \u002F Ctrl-w \u002F Ctrl-u","Backspace \u002F delete word \u002F delete line while typing — make coding-vim feel ergonomic.","i hello world\u003CCtrl-w>   leaves 'hello '",{"section":2564,"command":2569,"description":2570,"options":2571,"example":2572},"Ctrl-o \u003Ccmd> \u002F Ctrl-r \u003Creg>","Run a single normal-mode command (Ctrl-o); paste register into insert (Ctrl-r).","Ctrl-r = expr to evaluate an expression on the fly","Ctrl-r \" the unnamed register ; Ctrl-r 0 from the yank register ; Ctrl-r =5+5 to insert 10",{"section":2574,"command":2575,"description":2576,"options":2577,"example":2578},"Edit Operators","d \u002F x \u002F X \u002F c","Delete \u002F delete char under \u002F before \u002F change (delete + enter insert). Combine with motion: dw\u002Fxp\u002Fc$.","dd delete line; cc change line; D delete to EOL; C change to EOL","dw | dw$ | dw | 3dd | C reformat current line",{"section":2574,"command":2580,"description":2581,"example":2582},"y \u002F yy \u002F Y","Yank (copy). yy \u002F Y yank current line; y$ \u002F yW etc. take a motion.","y2w yy p gp  —  yank 2 words, line, paste, paste below without moving cursor",{"section":2574,"command":2584,"description":2585,"example":2586},"p \u002F P \u002F gp \u002F gP","Paste after (p) \u002F before (P) the cursor. gp\u002FgP leave the cursor at the end of pasted text.","p below current ; P above ; gp after, cursor at end",{"section":2574,"command":2588,"description":2589,"example":2590},"u \u002F Ctrl-r \u002F U","Undo \u002F redo (Ctrl-r). U restores the line to original (deprecated in favor of repeatable counts).","u u u  ;  Ctrl-r Ctrl-r  ;  5u to undo last 5 changes",{"section":2574,"command":2592,"description":2593,"example":2594},". \u002F @: \u002F q:","Repeat the last edit (.) — extremely powerful. @: repeats a recent macro; q: opens the command history.","i Monday\u003CEsc>  ;  then . . . . across several lines",{"section":2574,"command":2596,"description":2597,"example":2598},"r \u002F R \u002F J \u002F gq","Replace single char (r\u003Cchar>) \u002F enter Replace mode (R) \u002F join lines (J, gJ without space) \u002F format (gq{motion}).","raZ to change one char ; J to join ; gqap format the current paragraph",{"section":2600,"command":2601,"description":2602,"example":2603},"Indent",">> \u002F \u003C\u003C \u002F = \u002F :set autoindent","Indent \u002F dedent \u002F auto-indent (=). Combines with motion: =G to the end; `gg=G` format whole file.","5>> indent 5 lines ; =ap auto-indent paragraph ; gg=G format buffer (whole file)",{"section":2605,"command":2606,"description":2607,"options":2608,"example":2609},"Search & Replace","\u002Fpat \u002F ?pat \u002F n \u002F N","Search forward (\u002F) \u002F backward (?); n \u002F N repeat in the same \u002F opposite direction.","\u002F\\\u003Cword\\> word boundary; \\v very-magic regex; \\c ignore case; \\C case-sensitive","\u002FTODO\\c  ;  n next ; N previous ; * \u002F # to search the word under cursor",{"section":2605,"command":2611,"description":2612,"example":2613},"* \u002F # \u002F g* \u002F g#","Search for the word under cursor: * forward (# backward). g* includes adjacent boundary.","Hover on foo then *    —    jumps to next foo, n continues",{"section":2605,"command":2615,"description":2616,"options":2617,"example":2618},":%s\u002Fpat\u002Frep\u002Fg \u002F :5,12s\u002Ffoo\u002Fbar\u002Fg","Substitute — global, with optional ranges, flags and confirm per match.","%s \u002F g global; \u002Fc confirm; \u002Fi ignore case; \u002FI case; \u002Fe no error; \u002Fn count",":%s\u002F\\bfoo\\b\u002Fbar\u002Fgc   —   replace whole word \"foo\" with \"bar\", confirm each",{"section":2605,"command":2620,"description":2621,"example":2622},":g\u002Fpat\u002Fd  \u002F  :v\u002Fpat\u002Fm$","Operate on matches: :g\u002Fpat\u002Fd delete lines matching; :v\u002Fpat\u002Fm$ move non-matching to end.",":v\u002F^#\\|^$\u002Fd   delete all comment-blank only lines",{"section":2624,"command":2625,"description":2626,"options":2627,"example":2628},"Buffers, Tabs, Windows",":e file  \u002F  :b\u003CN>  \u002F  :bn :bp :ls","Open another file (:e), list (`:ls`), go to a buffer by id (`:b 3`), next\u002Fprev (`:bn`\u002F`bp`).",":e . file explorer; :bd delete current buffer; :bn! force; hidden",":e src\u002Findex.ts :ls :b 3 :bp :bn",{"section":2624,"command":2630,"description":2631,"example":2632},":sp :vs \u002F Ctrl-w j\u002Fk\u002Fh\u002Fl","Split horizontally\u002Fvertically; Ctrl-w + motion to move between windows.",":vs src\u002Findex.ts | Ctrl-w l | Ctrl-w j  —  work in adjacent panes",{"section":2624,"command":2634,"description":2635,"example":2636},":tabnew \u002F gt \u002F gT \u002F :tabclose","Use tabs when you want one-buffer-per-task screens.",":tabnew README.md gt gT :tabclose :tabonly",{"section":2638,"command":2639,"description":2640,"example":2641},"View & Setting",":set nu \u002F :set relativenumber","Toggle line numbers; `relativenumber` shows distance from cursor (great with motions).",":set relativenumber && 5j will count in your head",{"section":2638,"command":2643,"description":2644,"example":2645},":set syntax on  \u002F  :set filetype=ts","Enable syntax highlighting \u002F force a file type for an extensionless file.",":set ft=markdown  ;  :set bg=dark for dark mode",{"section":2638,"command":2647,"description":2648,"options":2649,"example":2650},":set paste \u002F :set wrap \u002F :set hlsearch","Paste toggles: paste avoids auto-indent on insert. hlsearch persists matches.",":noh clear highlight now",":set paste then i\u003CCtrl-r>+ in some terminals",{"section":2652,"command":2653,"description":2654,"options":2655,"example":2656},"Visual & Block Mode","v \u002F V \u002F Ctrl-v","Visual \u002F line-visual \u002F block-visual — block lets you edit columns of text.","v -> o toggle endpoints of selection in visual mode","Ctrl-v 5j I \u002F\u002F Esc  —  prepend  \u002F\u002F  to 6 lines (classic comment-uncomment)",{"section":2652,"command":2658,"description":2659,"example":2660},"gv \u002F o (in visual)","Re-select the previous visual area; `o` toggles the active end of the selection.","Make a block selection, change something, run the same edit again with .",{"section":2662,"command":2663,"description":2664,"options":2665,"example":2666},"Registers & Macros","\"ayy \u002F \"ap \u002F :reg","Use a named register a to yank, then paste from a. :reg lists all registers.","\"0 last yank; \"_ black hole; \"+ system clipboard (if +clipboard)","\"ayy \"ap   ;   :reg to list named, 0, +, *",{"section":2662,"command":2668,"description":2669,"example":2670},"q\u003Creg> ... q \u002F @\u003Creg> \u002F @@","Record a macro into register \u003Creg>, replay with @\u003Creg>; @@ repeats the last macro.","qa I\" \u003CEsc> $ \" \u003CEsc> q   5j @a  —  quote cells across rows",{"section":2672,"command":2673,"description":2674,"example":2675},"External",":!cmd \u002F :r !cmd","Run a shell command from inside Vim; :r !cmd inserts its output.",":r !date   ;   :!%:clean :r ...",{"section":2672,"command":2677,"description":2678,"example":2679},":r file \u002F :source file.vim","Read contents of file at cursor; :source runs a Vim script (.vimrc, plugin file).",":r ~\u002F.vimrc  to paste whole config; :runtime! syntax\u002Ffoo.vim",{"section":2672,"command":2681,"description":2682,"example":2683},":help \u003Ctopic>","Vim's offline help is excellent. `Ctrl-]` jumps to the tag under cursor.",":help gq :help motion.txt :help :terminal — open terminal-in-vim (8.0+)",{"section":2672,"command":2685,"description":2686,"options":2687,"example":2688},":terminal","Open an embedded terminal (Vim 8+ \u002F Neovim).",":vert terminal splits vertically; :term bash; Ctrl-w N : leave terminal mode",":vert term bash :resize 15 && run tests live"]