Gemini CLI cheat sheet
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.
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)
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
| Flag | What it does |
|---|---|
-m, --model | Model for the session (gemini-2.5-pro / -flash) |
-p, --prompt | Headless: run, print, exit |
-i, --prompt-interactive | Start interactive with an initial prompt |
-a, --all-files | Recursively include all files in cwd as context |
--include-directories | Add workspace dirs (max 5) |
-s, --sandbox | Run tool execution inside a sandbox |
--yolo | Auto-approve all tool calls (= --approval-mode yolo) |
--approval-mode | default · auto_edit · yolo |
--output-format | text (default) or json |
Slash · @file · !shell
| Command | What it does |
|---|---|
/help · /? | Show help and available commands |
/chat save|resume|list | Save / branch / restore conversation checkpoints |
/compress | Replace chat history with a summary to save tokens |
/memory add|show|refresh | Manage context loaded from GEMINI.md |
/tools · /mcp | List built-in tools · MCP servers and their tools |
/stats | Token usage, cache savings, session duration |
/restore | Revert files to a pre-tool state (needs --checkpointing) |
/init | Generate a tailored GEMINI.md |
@src/main.js explain this | Inject a file / directory into the prompt |
!npm test | Run one shell command (! alone toggles shell mode) |
.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
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.
Claude Code
Aider
Goose
Qwen Code
Crush
Grok CLI
OpenHands CLI
Cline CLI
Roo Code CLI
Continue CLI