{"id":167354,"date":"2026-05-03T10:28:33","date_gmt":"2026-05-03T07:28:33","guid":{"rendered":"https:\/\/computingforgeeks.com\/gemini-cli-cheat-sheet\/"},"modified":"2026-06-15T19:01:05","modified_gmt":"2026-06-15T16:01:05","slug":"gemini-cli-cheat-sheet","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/gemini-cli-cheat-sheet\/","title":{"rendered":"Gemini CLI Cheat Sheet &#8211; Commands and Examples"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Gemini CLI ships with five subcommand groups, more than 30 flags, an interactive REPL with 25+ slash commands, a custom-commands system based on TOML files, the Skills framework, MCP server management, sandboxing via Docker or Podman, checkpointing for safe rollbacks, multi-directory workspace support, GEMINI.md project memory, and the ability to migrate hooks from Claude Code. The official docs scatter that surface across a dozen pages. This cheat sheet collapses everything into one reference, with real outputs captured on Ubuntu 26.04 LTS using Gemini CLI 0.40.1 against a paid Google AI Studio API key.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Heads up:<\/strong> Google retires the hosted Gemini CLI on 18 June 2026 for free, Google AI Pro, and Google AI Ultra accounts, moving those tiers to the new <a href=\"https:\/\/computingforgeeks.com\/install-antigravity-cli-linux-macos-windows\/\" target=\"_blank\" rel=\"noreferrer noopener\">Antigravity CLI<\/a>. Most of this cheat sheet was captured against a paid API key, and that path keeps working: the open-source <code>gemini<\/code> binary and any paid Gemini or Vertex AI key are unaffected. Only the free Google-account quota goes away. If you sign in with a plain Google account, jump to <a href=\"#migrate-antigravity\">Migrating to Antigravity CLI<\/a> below.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you came from the <a href=\"https:\/\/computingforgeeks.com\/install-configure-gemini-cli\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gemini CLI install guide<\/a> and want one page open while you code, this is it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>This cheat sheet was refreshed in June 2026 to cover the Gemini CLI to Antigravity CLI move; the commands were verified in May 2026 with Gemini CLI 0.40.1 against gemini-2.5-flash-lite, gemini-2.5-pro, and gemini-3-flash-preview on Ubuntu 26.04 LTS (Linux kernel 7.0).<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Quick install reminder<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo npm install -g @google\/gemini-cli\ngemini --version<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>0.40.1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For the full prerequisites (Node 20+, browser auth, free-tier quota notes) and platform-specific install paths, the dedicated <a href=\"https:\/\/computingforgeeks.com\/install-configure-gemini-cli\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gemini CLI install walkthrough<\/a> covers Linux, macOS, and Windows.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Top-level command map<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>Purpose<\/th><\/tr><\/thead><tbody>\n<tr><td><code>gemini<\/code><\/td><td>Launch the interactive TUI agent (default).<\/td><\/tr>\n<tr><td><code>gemini [query]<\/code><\/td><td>Open the TUI seeded with an initial prompt.<\/td><\/tr>\n<tr><td><code>gemini -p \"...\"<\/code><\/td><td>Headless one-shot mode, prints to stdout.<\/td><\/tr>\n<tr><td><code>gemini -i \"...\"<\/code><\/td><td>Run the prompt, then stay in the REPL.<\/td><\/tr>\n<tr><td><code>cat file | gemini<\/code><\/td><td>Pipe stdin into a query.<\/td><\/tr>\n<tr><td><code>gemini -r latest<\/code><\/td><td>Resume the most recent session.<\/td><\/tr>\n<tr><td><code>gemini mcp<\/code><\/td><td>Manage MCP servers (add, remove, list, enable, disable).<\/td><\/tr>\n<tr><td><code>gemini extensions<\/code><\/td><td>Install, list, link, validate, update, enable, disable extensions.<\/td><\/tr>\n<tr><td><code>gemini skills<\/code><\/td><td>Manage agent skills (install, link, list, enable, disable, &#8211;all variants).<\/td><\/tr>\n<tr><td><code>gemini hooks<\/code><\/td><td>Migrate hooks from Claude Code (currently the only subcommand).<\/td><\/tr>\n<tr><td><code>gemini gemma<\/code><\/td><td>Local Gemma model routing (setup, start, stop, status, logs).<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Authentication and config<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On first launch the CLI looks for one of three auth methods. Pick the one that matches your account:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><strong>Google OAuth (free tier)<\/strong>: launch <code>gemini<\/code> in a desktop session, follow the browser flow. ~60 requests per minute, ~1,000 requests per day.<\/li>\n\n\n<li><strong>API key<\/strong>: set <code>GEMINI_API_KEY<\/code> from a Google AI Studio key. Best for servers, CI, and headless boxes.<\/li>\n\n\n<li><strong>Vertex AI<\/strong>: set <code>GOOGLE_GENAI_USE_VERTEXAI=true<\/code> with a service account. Best for enterprise or GCP-billed teams.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Real error from a fresh box without keys:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gemini -p 'echo \/help' --output-format text\nPlease set an Auth method in your \/root\/.gemini\/settings.json\nor specify one of the following environment variables before running:\n  GEMINI_API_KEY, GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_GENAI_USE_GCA<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And a real free-tier quota error when the daily window is hit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>* Quota exceeded for metric: generativelanguage.googleapis.com\/generate_content_free_tier_requests,\n  limit: 5, model: gemini-3-flash\nPlease retry in 718.667265ms.\nSuggested retry after 60s.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run <code>\/stats<\/code> inside the REPL to see live token usage, or watch the JSON output of <code>--output-format json<\/code> in headless mode (it prints a full <code>stats<\/code> object after every call).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">API key on a Linux server<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>export GEMINI_API_KEY=\"aiza...\"\necho 'export GEMINI_API_KEY=\"aiza...\"' &gt;&gt; ~\/.bashrc\ngemini --list-extensions<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Where the CLI stores state<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Real layout from a working install after a few sessions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ls -la ~\/.gemini\/\ndrwxr-xr-x  history\/                 # interactive REPL transcripts per project\n-rw-r--r--  installation_id          # anonymized telemetry id\n-rw-r--r--  projects.json            # known projects map\ndrwxr-xr-x  tmp\/                     # tool sandbox scratch\ndrwxr-xr-x  commands\/                # custom TOML slash commands\n# settings.json appears once you save preferences via \/settings or by hand<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>projects.json<\/code> tracks which directories you have used the CLI in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cat ~\/.gemini\/projects.json\n{\n  \"projects\": {\n    \"\/root\":           \"root\",\n    \"\/root\/gem-demo\":  \"gem-demo\"\n  }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">settings.json hierarchy and full schema<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Settings load in this priority order. Top of the list wins:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Project: <code>.\/.gemini\/settings.json<\/code><\/li>\n\n\n<li>User: <code>~\/.gemini\/settings.json<\/code><\/li>\n\n\n<li>System: <code>\/etc\/gemini-cli\/settings.json<\/code> (only used when present, useful for managed installs)<\/li>\n\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Annotated reference covering the keys most users actually touch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"selectedAuthType\": \"USE_GEMINI\",        \/\/ OAuth | USE_GEMINI | VERTEX\n  \"theme\": \"Default Dark\",\n  \"vimMode\": false,                        \/\/ vim keybindings in the input\n  \"preferredEditor\": \"vim\",                \/\/ for \/editor and Ctrl+X\n  \"autoAccept\": false,                     \/\/ auto-confirm read-only tool calls\n  \"checkpointing\": { \"enabled\": true },    \/\/ enables \/restore\n  \"sandbox\": \"docker\",                     \/\/ docker | podman | false\n  \"usageStatisticsEnabled\": false,         \/\/ anonymous telemetry\n  \"includeDirectories\": [\n    \"..\/backend\",\n    \"..\/frontend\"\n  ],\n  \"fileFiltering\": {\n    \"respectGitIgnore\":     true,\n    \"respectGeminiIgnore\":  true\n  },\n  \"chatCompression\": {\n    \"contextPercentageThreshold\": 60       \/\/ trigger \/compress at 60%\n  },\n  \"customThemes\": {\n    \"my-theme\": { \/* color tokens *\/ }\n  },\n  \"excludeTools\": [\"run_shell_command\"],   \/\/ blacklist tools entirely\n  \"coreTools\": [\"read_file\", \"write_file\"],\/\/ whitelist core tools (others off)\n  \"mcpServers\": {\n    \"context7\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@upstash\/context7-mcp@latest\"],\n      \"timeout\": 15000,\n      \"trust\": false,\n      \"includeTools\": [\"search_docs\"],\n      \"excludeTools\": [\"delete_doc\"]\n    }\n  },\n  \"telemetry\": { \"enabled\": false }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Project-scoped overrides live in <code>.\/.gemini\/settings.json<\/code> at the root of the repo. Same schema applies, project values override user values.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">.geminiignore<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Drop a <code>.geminiignore<\/code> at the repo root to keep the agent away from generated files, secrets, and large directories. Same syntax as <code>.gitignore<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># .geminiignore\nnode_modules\/\ndist\/\n.next\/\n.env\n.env.*\n*.log\nsecrets\/\ninfra\/state\/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">GEMINI.md project memory<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A <code>GEMINI.md<\/code> at the project root is auto-loaded into context every session. The pattern mirrors <a href=\"https:\/\/computingforgeeks.com\/claude-code-dot-claude-directory-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">CLAUDE.md in the .claude directory<\/a>. Memory loads hierarchically: global (<code>~\/.gemini\/GEMINI.md<\/code>), then project, then any per-subdirectory <code>GEMINI.md<\/code> for the path you are working in.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Imports work via <code>@.\/path<\/code> syntax inside any <code>GEMINI.md<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># GEMINI.md\n@.\/docs\/architecture.md\n@.\/docs\/coding-style.md\n\n## Project context\nThis is a Go microservice that...\n\n## Build and test\n- Build: `make build`\n- Test:  `go test .\/...`\n- Lint:  `golangci-lint run`<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Generate a starter file with <code>\/init<\/code> from inside the REPL. Reload after edits with <code>\/memory refresh<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Global flags reference<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Flag<\/th><th>Purpose<\/th><\/tr><\/thead><tbody>\n<tr><td><code>-m, --model<\/code><\/td><td>Override the model. Aliases: <code>auto<\/code>, <code>pro<\/code>, <code>flash<\/code>, <code>flash-lite<\/code>. Or full IDs.<\/td><\/tr>\n<tr><td><code>-p, --prompt<\/code><\/td><td>Run headless. Prompt prints, agent answers, process exits.<\/td><\/tr>\n<tr><td><code>-i, --prompt-interactive<\/code><\/td><td>Seed the TUI with a prompt and stay interactive.<\/td><\/tr>\n<tr><td><code>-y, --yolo<\/code><\/td><td>Auto-approve every action. Same as <code>--approval-mode yolo<\/code>.<\/td><\/tr>\n<tr><td><code>--approval-mode<\/code><\/td><td><code>default<\/code>, <code>auto_edit<\/code>, <code>yolo<\/code>, or <code>plan<\/code> (read-only).<\/td><\/tr>\n<tr><td><code>-w, --worktree<\/code><\/td><td>Run in a fresh git worktree. Pass a name or auto-generate.<\/td><\/tr>\n<tr><td><code>-s, --sandbox<\/code><\/td><td>Run tool calls in the configured sandbox (Docker or Podman).<\/td><\/tr>\n<tr><td><code>--skip-trust<\/code><\/td><td>Trust the current workspace for this session only.<\/td><\/tr>\n<tr><td><code>--checkpointing<\/code><\/td><td>Enable per-edit snapshots. Restore via <code>\/restore<\/code>.<\/td><\/tr>\n<tr><td><code>-r, --resume<\/code><\/td><td>Resume a previous session. <code>latest<\/code> or an index.<\/td><\/tr>\n<tr><td><code>--list-sessions<\/code><\/td><td>Print sessions for the current project.<\/td><\/tr>\n<tr><td><code>--delete-session N<\/code><\/td><td>Delete a session by index.<\/td><\/tr>\n<tr><td><code>--include-directories<\/code><\/td><td>Add directories to the workspace map (repeatable, comma-separated).<\/td><\/tr>\n<tr><td><code>-e, --extensions<\/code><\/td><td>Restrict the active extension set for this session.<\/td><\/tr>\n<tr><td><code>-l, --list-extensions<\/code><\/td><td>List installed extensions and exit.<\/td><\/tr>\n<tr><td><code>-o, --output-format<\/code><\/td><td><code>text<\/code>, <code>json<\/code>, or <code>stream-json<\/code>. Use <code>json<\/code> for scripting.<\/td><\/tr>\n<tr><td><code>--policy<\/code> \/ <code>--admin-policy<\/code><\/td><td>Load Policy Engine policy files for team-level lockdown.<\/td><\/tr>\n<tr><td><code>--allowed-mcp-server-names<\/code><\/td><td>Only enable named MCP servers for this run.<\/td><\/tr>\n<tr><td><code>--screen-reader<\/code><\/td><td>Optimise TUI output for screen readers.<\/td><\/tr>\n<tr><td><code>-d, --debug<\/code><\/td><td>Open the F12 debug console with raw event logs.<\/td><\/tr>\n<tr><td><code>-v, --version<\/code><\/td><td>Print version and exit.<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Model aliases<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Alias<\/th><th>Resolves to<\/th><th>Use<\/th><\/tr><\/thead><tbody>\n<tr><td><code>auto<\/code><\/td><td><code>gemini-2.5-pro<\/code> (or <code>gemini-3-pro-preview<\/code> if previews enabled)<\/td><td>Default. Sensible balance.<\/td><\/tr>\n<tr><td><code>pro<\/code><\/td><td><code>gemini-2.5-pro<\/code> \/ <code>gemini-3-pro-preview<\/code><\/td><td>Complex reasoning, refactor, code review.<\/td><\/tr>\n<tr><td><code>flash<\/code><\/td><td><code>gemini-2.5-flash<\/code><\/td><td>Fast everyday tasks.<\/td><\/tr>\n<tr><td><code>flash-lite<\/code><\/td><td><code>gemini-2.5-flash-lite<\/code><\/td><td>Cheap, simple lookups.<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Headless mode for scripting<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Quick code review of a diff\ngit diff main | gemini -p \"Review this diff for security issues. Format: bullets.\"\n\n# JSON output for downstream parsing (full token stats included)\ngemini -p \"List the top 3 risks in this Dockerfile\" --output-format json &lt; Dockerfile\n\n# Stream JSON events for tail-friendly log capture\ngemini -p \"Summarise this log\" --output-format stream-json &lt; \/var\/log\/syslog\n\n# Multi-directory context via --include-directories\ngemini -p \"Find shared validation logic\" --include-directories \/repo\/backend,\/repo\/frontend<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Trust gotcha on servers: Gemini refuses to run inside an untrusted directory unless you opt in. Real error from a fresh checkout:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Gemini CLI is not running in a trusted directory.\nTo proceed, either use --skip-trust, set GEMINI_CLI_TRUST_WORKSPACE=true,\nor trust this directory in interactive mode.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Pass <code>--skip-trust<\/code> for one-shot calls, or set <code>GEMINI_CLI_TRUST_WORKSPACE=true<\/code> in the environment for a CI runner.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Real session capture (JSON output)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Authentic output from a real run, captured exactly as the CLI emitted it. Note the dual-model split (a router model triages, the main model answers) and the per-model token breakdown:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gemini --skip-trust -p 'In one sentence, what does this code do?' \\\n    --output-format json --include-directories \/root\/gem-demo\n{\n  \"session_id\": \"5bd072ad-8d9b-4d86-89d2-1b1371a3e612\",\n  \"response\": \"The code defines a function that implements the FizzBuzz algorithm...\",\n  \"stats\": {\n    \"models\": {\n      \"gemini-2.5-flash-lite\": {\n        \"api\":    { \"totalRequests\": 1, \"totalLatencyMs\": 3405 },\n        \"tokens\": { \"input\": 742, \"candidates\": 55, \"thoughts\": 346, \"total\": 1143 },\n        \"roles\":  { \"utility_router\": { \"totalRequests\": 1, ... } }\n      },\n      \"gemini-3-flash-preview\": {\n        \"api\":    { \"totalRequests\": 2, \"totalLatencyMs\": 4131 },\n        \"tokens\": { \"input\": 15734, ... }\n      }\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Pipe the stream into <code>jq<\/code> to filter for the bits you need:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Just the answer\ngemini -p \"summarise\" --output-format json | jq -r .response\n\n# Total tokens spent across all models\ngemini -p \"review repo\" --output-format json | jq '[.stats.models[].tokens.total] | add'<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Interactive REPL slash commands<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>What it does<\/th><\/tr><\/thead><tbody>\n<tr><td><code>\/help<\/code><\/td><td>Show in-app command list.<\/td><\/tr>\n<tr><td><code>\/about<\/code><\/td><td>Print version, build, auth status, model.<\/td><\/tr>\n<tr><td><code>\/auth<\/code><\/td><td>Switch active auth method without restarting.<\/td><\/tr>\n<tr><td><code>\/init<\/code><\/td><td>Generate a starter <code>GEMINI.md<\/code> from the current repo.<\/td><\/tr>\n<tr><td><code>\/settings<\/code><\/td><td>Open <code>settings.json<\/code> for editing.<\/td><\/tr>\n<tr><td><code>\/theme<\/code><\/td><td>Cycle through built-in themes.<\/td><\/tr>\n<tr><td><code>\/vim<\/code><\/td><td>Toggle vim-style input keybindings.<\/td><\/tr>\n<tr><td><code>\/editor<\/code><\/td><td>Open <code>$EDITOR<\/code> for a long prompt.<\/td><\/tr>\n<tr><td><code>\/clear<\/code><\/td><td>Wipe the visible conversation, keep the model state.<\/td><\/tr>\n<tr><td><code>\/compress<\/code><\/td><td>Summarise the conversation in place. Frees tokens without losing context.<\/td><\/tr>\n<tr><td><code>\/copy<\/code><\/td><td>Copy the last reply to the system clipboard.<\/td><\/tr>\n<tr><td><code>\/corgi<\/code><\/td><td>Toggle the corgi mascot. Yes, really.<\/td><\/tr>\n<tr><td><code>\/chat list<\/code><\/td><td>List saved chats in the current project.<\/td><\/tr>\n<tr><td><code>\/chat save &lt;tag&gt;<\/code><\/td><td>Snapshot the current conversation under a tag.<\/td><\/tr>\n<tr><td><code>\/chat resume &lt;tag&gt;<\/code><\/td><td>Reload a saved chat into the active session.<\/td><\/tr>\n<tr><td><code>\/chat delete &lt;tag&gt;<\/code><\/td><td>Remove a saved chat.<\/td><\/tr>\n<tr><td><code>\/restore<\/code><\/td><td>List checkpoints from the current session.<\/td><\/tr>\n<tr><td><code>\/restore &lt;id&gt;<\/code><\/td><td>Roll files and conversation back to a checkpoint.<\/td><\/tr>\n<tr><td><code>\/memory show<\/code><\/td><td>Print the loaded GEMINI.md and per-session notes.<\/td><\/tr>\n<tr><td><code>\/memory add &lt;text&gt;<\/code><\/td><td>Append a note that survives the rest of the session.<\/td><\/tr>\n<tr><td><code>\/memory refresh<\/code><\/td><td>Re-read GEMINI.md from disk after edits.<\/td><\/tr>\n<tr><td><code>\/mcp<\/code><\/td><td>Show active MCP servers and their tools.<\/td><\/tr>\n<tr><td><code>\/mcp reload<\/code><\/td><td>Restart the configured MCP servers.<\/td><\/tr>\n<tr><td><code>\/tools<\/code><\/td><td>List active tools (built-in plus MCP plus extensions).<\/td><\/tr>\n<tr><td><code>\/skills reload<\/code><\/td><td>Reload skills from disk after edits.<\/td><\/tr>\n<tr><td><code>\/agents reload<\/code><\/td><td>Reload the agent registry.<\/td><\/tr>\n<tr><td><code>\/commands list<\/code><\/td><td>List all custom slash commands.<\/td><\/tr>\n<tr><td><code>\/commands reload<\/code><\/td><td>Re-read TOML command files.<\/td><\/tr>\n<tr><td><code>\/extensions reload<\/code><\/td><td>Reload extensions without exiting.<\/td><\/tr>\n<tr><td><code>\/directory show<\/code><\/td><td>List workspace roots.<\/td><\/tr>\n<tr><td><code>\/directory add &lt;path&gt;<\/code><\/td><td>Dynamically include a folder in the workspace.<\/td><\/tr>\n<tr><td><code>\/stats<\/code><\/td><td>Total token spend, cache hits, latency.<\/td><\/tr>\n<tr><td><code>\/stats model<\/code><\/td><td>Per-model breakdown.<\/td><\/tr>\n<tr><td><code>\/stats tools<\/code><\/td><td>Per-tool call count.<\/td><\/tr>\n<tr><td><code>\/ide install<\/code><\/td><td>Install IDE integration (VS Code companion).<\/td><\/tr>\n<tr><td><code>\/ide enable<\/code><\/td><td>Enable IDE context for the current session.<\/td><\/tr>\n<tr><td><code>\/privacy<\/code><\/td><td>Privacy policy and data handling.<\/td><\/tr>\n<tr><td><code>\/docs<\/code><\/td><td>Open the official docs.<\/td><\/tr>\n<tr><td><code>\/bug<\/code><\/td><td>Pre-fill a GitHub issue with anonymised diagnostics.<\/td><\/tr>\n<tr><td><code>\/quit<\/code><\/td><td>Exit the TUI cleanly.<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">@-files and ! shell passthrough<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Two patterns make the REPL ten times faster:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Attach a file\n@src\/auth.ts review this for SQL injection\n\n# Attach multiple files\n@src\/auth.ts @src\/db.ts find shared validation logic\n\n# Attach an entire directory recursively (respects .gitignore + .geminiignore)\n@.\/src\/api\/\n\n# Attach an image for vision-capable models\n@screenshot.png explain what this UI is doing\n\n# Run a shell command and feed output back into the chat\n!git status\n!docker compose ps\n\n# Enter persistent shell mode (a single ! on its own line)\n!\n$ pwd\n$ ls -la\n$ !          # exits shell mode<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Custom slash commands (TOML)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Custom commands are TOML files dropped under <code>.gemini\/commands\/<\/code> (project) or <code>~\/.gemini\/commands\/<\/code> (user). The filename becomes the slash command. A category folder produces namespaced commands:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><code>~\/.gemini\/commands\/review.toml<\/code> \u2192 <code>\/review<\/code><\/li>\n\n\n<li><code>~\/.gemini\/commands\/security\/audit.toml<\/code> \u2192 <code>\/security:audit<\/code><\/li>\n\n<\/ul>\n\n\n<h3 class=\"wp-block-heading\">TOML schema<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># ~\/.gemini\/commands\/review.toml\ndescription = \"Review code for security issues\"\nprompt = \"\"\"Please review the following code for security vulnerabilities:\n\n{{args}}\n\nFocus on injection, auth, and crypto issues.\"\"\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Invoke from the REPL or headless mode. The <code>{{args}}<\/code> placeholder receives whatever you typed after the command name. The agent has access to whatever <code>@<\/code>-files you mention:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gemini -p '\/review @unsafe.py'\n1. Avoid `os.system`. Use the `subprocess` module instead, which provides\n   better control and security.\n2. Use Argument Lists. When using `subprocess.run` or `subprocess.Popen`,\n   pass the command and its arguments as a list rather than a single string.\n3. Disable Shell Execution. Set `shell=False` to ensure the command is\n   executed directly without a shell.\n...<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Built-in tools reference<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The agent calls these tools directly. List them at runtime with <code>\/tools<\/code> and lock down individuals via <code>excludeTools<\/code> or <code>coreTools<\/code> in <code>settings.json<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Tool<\/th><th>Purpose<\/th><\/tr><\/thead><tbody>\n<tr><td><code>read_file<\/code><\/td><td>Read one file into context.<\/td><\/tr>\n<tr><td><code>read_many_files<\/code><\/td><td>Bulk read multiple files.<\/td><\/tr>\n<tr><td><code>write_file<\/code><\/td><td>Create or overwrite a file.<\/td><\/tr>\n<tr><td><code>replace<\/code><\/td><td>Targeted string-replace edit.<\/td><\/tr>\n<tr><td><code>list_directory<\/code><\/td><td>List a directory.<\/td><\/tr>\n<tr><td><code>glob<\/code><\/td><td>Glob-pattern file search.<\/td><\/tr>\n<tr><td><code>search_file_content<\/code><\/td><td>Ripgrep-style content search.<\/td><\/tr>\n<tr><td><code>codebase_investigator<\/code><\/td><td>Cross-file reasoning over the workspace.<\/td><\/tr>\n<tr><td><code>run_shell_command<\/code><\/td><td>Execute a shell command (subject to approval mode).<\/td><\/tr>\n<tr><td><code>web_fetch<\/code><\/td><td>Fetch a URL and add its rendered text to context.<\/td><\/tr>\n<tr><td><code>google_web_search<\/code><\/td><td>Run a Google Search and return ranked results.<\/td><\/tr>\n<tr><td><code>save_memory<\/code><\/td><td>Persist a fact across sessions (writes to GEMINI.md).<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Sandbox: Docker or Podman<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>--sandbox<\/code> flag and <code>\"sandbox\": \"docker\" | \"podman\"<\/code> in settings tell the CLI to run every shell tool call inside a container. The agent can still read and write files in the workspace, but binary execution happens in an isolated environment. Useful when you do not trust an extension or want to test risky commands without leaving traces.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># One-off sandbox run\ngemini --sandbox -p \"build and run the test suite\"\n\n# Permanent sandbox via settings\necho '{\"sandbox\":\"docker\"}' &gt; ~\/.gemini\/settings.json<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Pair the sandbox with <code>--approval-mode plan<\/code> for the strictest &#8220;look, do not touch&#8221; mode.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Checkpointing and \/restore<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Checkpointing snapshots files before each agent edit. If a refactor goes sideways, roll back without touching git:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Enable for one session\ngemini --checkpointing\n\n# Or persist in settings.json\n{\n  \"checkpointing\": { \"enabled\": true }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inside the REPL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/restore           # list checkpoints\n\/restore 3         # roll back to checkpoint 3 (files + chat state)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use this when iterating on a tricky refactor: ask, review, restore, retry. Faster than <code>git stash<\/code> for small experiments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Approval modes<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Mode<\/th><th>Behaviour<\/th><th>When to use<\/th><\/tr><\/thead><tbody>\n<tr><td><code>default<\/code><\/td><td>Prompts on every tool call.<\/td><td>First time on a new repo.<\/td><\/tr>\n<tr><td><code>auto_edit<\/code><\/td><td>Auto-approves edits, prompts on shell + writes outside the workspace.<\/td><td>Routine refactor work after you trust the agent.<\/td><\/tr>\n<tr><td><code>yolo<\/code><\/td><td>Auto-approves everything. Same as <code>--yolo<\/code> or <code>Ctrl+Y<\/code>.<\/td><td>Disposable VMs and sandboxed worktrees only.<\/td><\/tr>\n<tr><td><code>plan<\/code><\/td><td>Read-only. Refuses edits, refuses shell. Only reads and reasons.<\/td><td>Code reviews, audits, exploration.<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Keyboard shortcuts<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Action<\/th><th>Shortcut<\/th><\/tr><\/thead><tbody>\n<tr><td>Submit message<\/td><td><code>Enter<\/code><\/td><\/tr>\n<tr><td>New line in input<\/td><td><code>Shift+Enter<\/code><\/td><\/tr>\n<tr><td>Cancel running tool call \/ prompt<\/td><td><code>Esc<\/code><\/td><\/tr>\n<tr><td>Exit (press twice)<\/td><td><code>Ctrl+C<\/code> <code>Ctrl+C<\/code><\/td><\/tr>\n<tr><td>Clear screen<\/td><td><code>Ctrl+L<\/code><\/td><\/tr>\n<tr><td>Paste text or image<\/td><td><code>Ctrl+V<\/code><\/td><\/tr>\n<tr><td>Toggle YOLO mode<\/td><td><code>Ctrl+Y<\/code><\/td><\/tr>\n<tr><td>Open external <code>$EDITOR<\/code> for prompt<\/td><td><code>Ctrl+X<\/code><\/td><\/tr>\n<tr><td>Toggle tool-call descriptions<\/td><td><code>Ctrl+T<\/code><\/td><\/tr>\n<tr><td>Autocomplete (commands, files, models)<\/td><td><code>Tab<\/code><\/td><\/tr>\n<tr><td>Input history navigation<\/td><td><code>Up<\/code> \/ <code>Down<\/code><\/td><\/tr>\n<tr><td>Open debug console<\/td><td><code>F12<\/code> (with <code>--debug<\/code>)<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Managing MCP servers<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gemini mcp add --help\nUsage: gemini mcp add [options] &lt;name&gt; &lt;commandOrUrl&gt; [args...]\nOptions:\n  -s, --scope          user | project (default: project)\n  -t, --transport      stdio | sse | http (default: stdio)\n  -e, --env KEY=value  environment variables (repeatable)\n  -H, --header         HTTP headers for sse\/http (repeatable)\n      --timeout        connection timeout in ms\n      --trust          bypass tool-call confirmation prompts\n      --description    server description\n      --include-tools  comma-separated tool whitelist\n      --exclude-tools  comma-separated tool blacklist<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Common server adds<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Filesystem (scoped to one directory)\ngemini mcp add filesystem npx -y @modelcontextprotocol\/server-filesystem \/home\/user\/projects\n\n# GitHub (needs GITHUB_TOKEN)\ngemini mcp add github -e GITHUB_TOKEN=$GITHUB_TOKEN \\\n  npx -y @modelcontextprotocol\/server-github\n\n# Postgres\ngemini mcp add postgres npx -y @modelcontextprotocol\/server-postgres \\\n  \"postgresql:\/\/user:pass@host:5432\/db\"\n\n# Context7 with a tool whitelist\ngemini mcp add context7 --include-tools search_docs \\\n  npx -y @upstash\/context7-mcp@latest\n\n# Remote SSE server with auth header\ngemini mcp add company-tools https:\/\/mcp.company.com\/sse \\\n  --transport sse \\\n  -H \"Authorization: Bearer $MCP_TOKEN\" \\\n  --timeout 20000<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">List the active set with <code>gemini mcp list<\/code>, toggle individuals from inside the TUI with <code>\/mcp<\/code>, restart all of them with <code>\/mcp reload<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Skills<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Skills are self-contained agent roles with their own prompt, tools, and metadata. The CLI ships one built-in skill (<code>skill-creator<\/code>) that helps you write new ones. Real list output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gemini skills list --all\nDiscovered Agent Skills:\n\nskill-creator [Enabled] [Built-in]\n  Description: Guide for creating effective skills.\n  Location:    \/usr\/local\/lib\/node_modules\/@google\/gemini-cli\/bundle\/builtin\/skill-creator\/SKILL.md<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Install from a git repo (user scope by default)\ngemini skills install https:\/\/github.com\/your-org\/skill-release-notes\n\n# Install from a sub-path inside a monorepo of skills\ngemini skills install https:\/\/github.com\/some\/monorepo --path skills\/security-review\n\n# Project-scoped install\ngemini skills install .\/local-skill --scope workspace\n\n# Live-link a local skill while you build it\ngemini skills link .\/security-review\n\n# Toggle individuals (or all)\ngemini skills enable security-review\ngemini skills disable security-review\ngemini skills enable --all\ngemini skills disable --all\n\n# Acknowledge security risks and skip the prompt\ngemini skills install &lt;source&gt; --consent<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Extensions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Extensions bundle commands, themes, MCP servers, hook handlers, and policies. Distribute a full toolkit to a team in one git URL.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Install from a github repo with auto-update\ngemini extensions install https:\/\/github.com\/your-org\/your-extension --auto-update\n\n# Install at a specific git ref (tag, branch, commit)\ngemini extensions install https:\/\/github.com\/your-org\/your-extension --ref v2.1.0\n\n# Install pre-release builds\ngemini extensions install https:\/\/github.com\/your-org\/your-extension --pre-release\n\n# Install from a local checkout (live-linked, edits reflect immediately)\ngemini extensions link .\/my-extension\n\n# List installed\ngemini extensions list\n\n# Update everything\ngemini extensions update --all\n\n# Disable temporarily\ngemini extensions disable my-extension\n\n# Validate before publishing\ngemini extensions validate .\/my-extension\n\n# Scaffold a new extension from a template\ngemini extensions new .\/my-new-ext mcp-server<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Available templates for <code>extensions new<\/code>: <code>custom-commands<\/code>, <code>exclude-tools<\/code>, <code>hooks<\/code>, <code>mcp-server<\/code>, <code>policies<\/code>, <code>skills<\/code>, <code>themes-example<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hooks (migrate from Claude Code)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you already wrote hooks for Claude Code, the migrate command rewrites them into Gemini&#8217;s format:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gemini hooks migrate --from-claude\n# Reads .claude\/settings.json, writes converted hook config under .gemini\/\n# Prints any hooks that need manual review<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The hooks system itself uses the same event taxonomy: PreToolUse, PostToolUse, Stop, UserPromptSubmit. The rewrite preserves matchers and commands, but anything that called a Claude-specific tool name needs a manual update.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Local Gemma model routing<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Gemma is Google&#8217;s open-weights model family. The <code>gemini gemma<\/code> subcommand provisions a local LiteRT-LM server so the CLI can route prompts to a CPU- or GPU-hosted Gemma model instead of the cloud API. Useful for offline work, sensitive code, or saving free-tier quota:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Download model + runtime, default port 9379\ngemini gemma setup\n\n# Setup without auto-starting\ngemini gemma setup --start=false\n\n# Re-download even if present\ngemini gemma setup --force\n\n# Lifecycle\ngemini gemma start\ngemini gemma status\ngemini gemma logs\ngemini gemma stop<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">With Gemma running, set the model on a per-invocation basis with <code>-m gemma-3-12b<\/code>. Combine with <code>--approval-mode plan<\/code> for read-only local exploration that costs nothing and leaks nothing.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sessions, history, and resume<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>gemini --list-sessions             # what is recoverable\ngemini --resume latest             # pick up the most recent\ngemini --resume 3                  # pick up index 3\ngemini --delete-session 5          # tidy up<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Real output after a run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gemini --list-sessions\nAvailable sessions for this project (1):\n  1. List 3 functions defined (Just now) [875c2ac1-4eec-42dd-a7b0-cccc97bcbd53]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sessions live under <code>~\/.gemini\/history\/&lt;project&gt;\/<\/code>. They are JSON, so you can grep, archive, or feed them into another tool.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Worktree workflow<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>-w<\/code> flag spins the agent up inside a fresh git worktree. Useful for parallel sessions on the same repo, or to keep the agent&#8217;s edits isolated from your in-flight branch.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Auto-named worktree\ngemini -w -p \"refactor src\/auth\/* into smaller modules\"\n\n# Named worktree (created if missing, reused if it exists)\ngemini -w fix-flaky-tests<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When the agent finishes, review the diff with <code>git diff<\/code> inside the worktree, then merge or discard with the usual <code>git worktree<\/code> commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">IDE integration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The CLI can attach to an editor for richer context (cursor position, open file, diff view). Currently best-supported in VS Code and Zed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Inside the REPL\n\/ide install     # installs the companion extension\n\/ide enable      # connects this session to the IDE<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Or for Zed (ACP \/ Agent Client Protocol)\ngemini --experimental-acp\ngemini --experimental-zed-integration<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Output formats and JSON parsing<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Plain text. Default. Best for shell pipes and humans.\ngemini -p \"summarise\" --output-format text &lt; report.md\n\n# JSON. One object on stdout. Easiest to parse with jq.\ngemini -p \"extract action items\" --output-format json &lt; meeting.txt | jq .\n\n# Stream JSON. One event per line. Best for long-running prompts.\ngemini -p \"review the entire repo\" --output-format stream-json | tee events.ndjson<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>--raw-output<\/code> only when you specifically need ANSI escapes preserved. Pair it with <code>--accept-raw-output-risk<\/code> to suppress the security warning. Untrusted model output piped to a terminal can issue control sequences, so leave the warning on whenever the prompt sources are not yours.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors and fixes<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Error: &#8220;Please set an Auth method&#8221;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No env var, no <code>settings.json<\/code>. Either export <code>GEMINI_API_KEY<\/code> or run <code>gemini<\/code> interactively once and choose an auth method.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Error: &#8220;Gemini CLI is not running in a trusted directory&#8221;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pass <code>--skip-trust<\/code> for one run, set <code>GEMINI_CLI_TRUST_WORKSPACE=true<\/code> in the environment for CI, or trust the directory once from the interactive UI for normal desktop work.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Error: &#8220;Quota exceeded for metric: generate_content_free_tier_requests&#8221;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Free-tier OAuth has per-minute and per-day caps. The CLI auto-retries with backoff, but if the daily cap is hit you wait until reset. Switch to API key auth (paid AI Studio key) or to a Gemma local model for the rest of the day.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Error: &#8220;Ripgrep is not available. Falling back to GrepTool&#8221;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Install ripgrep (<code>sudo apt install -y ripgrep<\/code> on Ubuntu, <code>sudo dnf install -y ripgrep<\/code> on Rocky\/Fedora). Big speed-up on large repos. The CLI falls back gracefully if it is missing, but searches take longer.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue: WSL2 path mismatches<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If <code>gemini<\/code> launches under Windows but tries to read a WSL path, configure <code>PATH<\/code> and <code>HOME<\/code> consistently. Easiest fix: install Gemini CLI inside the WSL distro using the Linux instructions, not the Windows installer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Gemini CLI vs Claude Code vs Codex CLI vs Aider vs OpenCode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Picking between the terminal AI coding agents comes down to budget, ecosystem, and the model behaviour you prefer:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><strong>Gemini CLI<\/strong>: free OAuth tier (60 RPM, 1K RPD), 1M-token Gemini 2.5 Pro context, native Google Search tool, strong at long-document reasoning.<\/li>\n\n\n<li><strong>Claude Code<\/strong>: paid Pro\/Max, deepest agent ecosystem (skills, hooks, MCP), best Sonnet\/Opus models. See the <a href=\"https:\/\/computingforgeeks.com\/claude-code-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Claude Code cheat sheet<\/a>.<\/li>\n\n\n<li><strong>Codex CLI<\/strong>: pay-per-use OpenAI, sharpest at short focused refactors. See the <a href=\"https:\/\/computingforgeeks.com\/codex-cli-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Codex CLI cheat sheet<\/a>.<\/li>\n\n\n<li><strong>Aider<\/strong>: git-native, multi-provider, repo-map-aware. See the <a href=\"https:\/\/computingforgeeks.com\/aider-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Aider cheat sheet<\/a>.<\/li>\n\n\n<li><strong>OpenCode<\/strong>: open-source TUI, server-mode native, multi-provider. See the <a href=\"https:\/\/computingforgeeks.com\/opencode-cli-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenCode CLI cheat sheet<\/a>, plus the <a href=\"https:\/\/computingforgeeks.com\/opencode-vs-claude-code-vs-cursor\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenCode vs Claude Code vs Cursor comparison<\/a>.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Is Gemini CLI free?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes on the OAuth tier. Sign in with a Google account and you get ~60 requests per minute and ~1,000 requests per day at no cost. Heavier usage routes through an AI Studio API key, which is paid per token.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where is the Gemini CLI config file?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">User-level config is <code>~\/.gemini\/settings.json<\/code>. Project-level overrides go in <code>.\/.gemini\/settings.json<\/code>. System-wide config can live at <code>\/etc\/gemini-cli\/settings.json<\/code>. Project values override user values, which override system values. Custom commands live alongside under <code>commands\/<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I create a custom slash command in Gemini CLI?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Drop a TOML file at <code>~\/.gemini\/commands\/&lt;name&gt;.toml<\/code> (user) or <code>.gemini\/commands\/&lt;name&gt;.toml<\/code> (project). Set <code>description<\/code> and <code>prompt<\/code>; use <code>{{args}}<\/code> as the placeholder. A subdirectory becomes a category, so <code>commands\/security\/audit.toml<\/code> creates <code>\/security:audit<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can Gemini CLI run offline?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. Run <code>gemini gemma setup<\/code> to download a Gemma model and the LiteRT-LM runtime locally. Once the local server is running on port 9379, set <code>-m gemma-3-12b<\/code> (or whichever variant you downloaded) and the cloud API is no longer needed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I use MCP servers with Gemini CLI?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Add a server with <code>gemini mcp add &lt;name&gt; &lt;command&gt; [args]<\/code>. Pass <code>-t http<\/code> or <code>-t sse<\/code> for remote servers. Use <code>-e KEY=val<\/code> for env vars, <code>-H \"Header: value\"<\/code> for HTTP headers, and <code>--include-tools<\/code> \/ <code>--exclude-tools<\/code> to whitelist or blacklist exposed tools. List active servers with <code>gemini mcp list<\/code> or <code>\/mcp<\/code> from inside the TUI.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is the difference between auto, pro, flash, and flash-lite?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>auto<\/code> is Gemini&#8217;s default routing (typically Gemini 2.5 Pro, or 3-Pro-preview if previews are enabled). <code>pro<\/code> pins the same family for complex reasoning. <code>flash<\/code> uses Gemini 2.5 Flash for fast everyday work. <code>flash-lite<\/code> uses the cheapest, fastest variant for utility tasks like routing or short summaries.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I roll back changes the agent made?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Launch with <code>--checkpointing<\/code> (or set <code>\"checkpointing\": {\"enabled\": true}<\/code> in <code>settings.json<\/code>). Inside the REPL, run <code>\/restore<\/code> to list snapshots and <code>\/restore &lt;id&gt;<\/code> to roll back files and conversation state to that point.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"migrate-antigravity\">Migrating to Antigravity CLI<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On 18 June 2026 Google switches off the hosted Gemini CLI backend for free users, Google AI Pro, Google AI Ultra, and Gemini Code Assist for individuals. After that date a plain Google sign-in stops returning responses, and Google points those users at the Antigravity CLI, a closed-source Go binary called <code>agy<\/code>. The change was announced at Google I\/O on 19 May 2026.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Gemini CLI itself is not deleted. The repository stays open source under Apache 2.0 and the <code>gemini<\/code> binary keeps running. What ends is the free Google-account quota, which leaves two honest paths:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Stay on Gemini CLI with a paid key.<\/strong> A paid Gemini API key, or Vertex AI and Gemini Enterprise Agent Platform credentials, keep your Gemini CLI access uninterrupted past 18 June, so every command in this cheat sheet keeps working. Gemini Code Assist Standard and Enterprise licences are unaffected too.<\/li>\n<li><strong>Move to Antigravity CLI.<\/strong> If you relied on the free Google login, install <code>agy<\/code> and sign in with the same Google account. Agent Skills, hooks, subagents, and extensions (now called plugins) carry over, though Antigravity applies its own usage limits in place of the old per-day request quota.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Installing the Antigravity CLI on Linux or macOS is a single command:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>curl -fsSL https:\/\/antigravity.google\/cli\/install.sh | bash\nagy --version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On Windows, run <code>irm https:\/\/antigravity.google\/cli\/install.ps1 | iex<\/code> in PowerShell instead. The full walkthrough, including where the OAuth token is cached and the &#8220;Illegal instruction&#8221; fix on older virtual machines, is in our <a href=\"https:\/\/computingforgeeks.com\/install-antigravity-cli-linux-macos-windows\/\" target=\"_blank\" rel=\"noreferrer noopener\">Antigravity CLI install guide<\/a>. Google&#8217;s own <a href=\"https:\/\/developers.googleblog.com\/an-important-update-transitioning-gemini-cli-to-antigravity-cli\/\" target=\"_blank\" rel=\"noreferrer noopener\">transition announcement<\/a> carries the per-tier details and the official migration FAQ.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Keep this open while you work<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Gemini CLI ships fast. When a new release lands, check the freshness block at the top of this page to confirm the version you are running matches what was tested. Pair this with the <a href=\"https:\/\/computingforgeeks.com\/install-configure-gemini-cli\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gemini CLI install guide<\/a> for first-time setup, the <a href=\"https:\/\/computingforgeeks.com\/aider-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Aider cheat sheet<\/a> if you alternate with that agent, and the <a href=\"https:\/\/computingforgeeks.com\/ollama-commands-cheat-sheet\/\" target=\"_blank\" rel=\"noreferrer noopener\">Ollama commands cheat sheet<\/a> if you also run local models alongside.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Gemini CLI ships with five subcommand groups, more than 30 flags, an interactive REPL with 25+ slash commands, a custom-commands system based on TOML files, the Skills framework, MCP server management, sandboxing via Docker or Podman, checkpointing for safe rollbacks, multi-directory workspace support, GEMINI.md project memory, and the ability to migrate hooks from Claude Code. &#8230; <a title=\"Gemini CLI Cheat Sheet &#8211; Commands and Examples\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/gemini-cli-cheat-sheet\/\" aria-label=\"Read more about Gemini CLI Cheat Sheet &#8211; Commands and Examples\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":167355,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39034,329,690],"tags":[17245,212,669],"cfg_series":[],"class_list":["post-167354","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-automation","category-dev","tag-ai","tag-automation","tag-dev"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/167354","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=167354"}],"version-history":[{"count":1,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/167354\/revisions"}],"predecessor-version":[{"id":167364,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/167354\/revisions\/167364"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/167355"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=167354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=167354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=167354"},{"taxonomy":"cfg_series","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/cfg_series?post=167354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}