Skip to content
Gemini CLI logo

Gemini CLI cheat sheet

$ gemini Google Official docs

Every command, flag and slash command for gemini — Google's open-source terminal agent — with a generous free tier on a personal Google account. 19+ commands, verified July 2026.

Install
npx @google/gemini-cli              # run without installing (Node 20+)
npm install -g @google/gemini-cli   # global install (command: gemini)
brew install gemini-cli             # Homebrew (macOS / Linux)
Start & run
gemini                              # interactive session in the current dir
gemini -p "Explain this codebase"   # headless: print and exit
gemini -m gemini-2.5-flash          # pick the model
gemini -i "Refactor auth.js"        # interactive, seeded with a prompt
gemini -a -p "Summarize the project"  # include ALL files as context
gemini --yolo                       # auto-approve every tool call

Key flags

FlagWhat it does
-m, --modelModel for the session (gemini-2.5-pro / -flash)
-p, --promptHeadless: run, print, exit
-i, --prompt-interactiveStart interactive with an initial prompt
-a, --all-filesRecursively include all files in cwd as context
--include-directoriesAdd workspace dirs (max 5)
-s, --sandboxRun tool execution inside a sandbox
--yoloAuto-approve all tool calls (= --approval-mode yolo)
--approval-modedefault · auto_edit · yolo
--output-formattext (default) or json

Slash · @file · !shell

CommandWhat it does
/help · /?Show help and available commands
/chat save|resume|listSave / branch / restore conversation checkpoints
/compressReplace chat history with a summary to save tokens
/memory add|show|refreshManage context loaded from GEMINI.md
/tools · /mcpList built-in tools · MCP servers and their tools
/statsToken usage, cache savings, session duration
/restoreRevert files to a pre-tool state (needs --checkpointing)
/initGenerate a tailored GEMINI.md
@src/main.js explain thisInject a file / directory into the prompt
!npm testRun one shell command (! alone toggles shell mode)
Config
.gemini/settings.json   ·   ~/.gemini/settings.json     # project / user
GEMINI.md                        # project context (/init to scaffold)

export GEMINI_API_KEY="…"        # from Google AI Studio  (GEMINI_MODEL sets default)
# …or "Login with Google": free tier = 60 requests/min, 1,000/day

gemini mcp add <name> <command> [args…]   # register an MCP server
Common one-liners
gemini -p "Explain the architecture of this codebase"
gemini -a -p "Write a README summarizing this project"    # whole dir as context
gemini --yolo -p "Run the test suite and fix any failing tests"
gemini -p "List all TODO comments as JSON" --output-format json

More CLI cheat sheets

Stop memorizing flags

Run Gemini CLI — and every other agent — from one app

TheVibeFather orchestrates Gemini CLI alongside every other coding CLI in one native macOS app. Bring the models you already pay for; keep your keys.