</> CodeAgents

Cheat Sheet

Gemini CLI

Google's AI coding agent for the terminal

Learn More

Installation & Auth

npm install -g @google/gemini-cliInstall Gemini CLI globally
geminiLaunch interactive REPL
gemini auth loginAuthenticate with Google account
GEMINI_API_KEY=...Set API key via environment variable
gemini --versionShow installed version

CLI Flags

--model gemini-3.1-pro-previewSpecify which model to use
--all_filesInclude all repo files in context
--yoloSkip all confirmation prompts
--sandboxRun tool calls in an isolated sandbox
--debugEnable verbose debug logging
--output_format jsonJSON output for scripting
--no-memoryDisable persistent memory for session

REPL Commands

/helpList available commands
/clearClear conversation history
/memory add <fact>Save a fact to persistent memory
/memory showDisplay all saved memory entries
/memory clearRemove all memory entries
/statsShow token usage statistics
/compressCompress conversation to save tokens
/toolsList available built-in tools
/quit or Ctrl+CExit Gemini CLI

File & Context

@filenameAttach a file to the prompt
@folder/Attach an entire folder
gemini --all_filesInclude all repo files in context
GEMINI.mdProject-level instructions file
~/.gemini/GEMINI.mdUser-level (global) instructions
.geminiignoreExclude files from context (gitignore syntax)
1M token context windowFull codebase fits in one request

Built-in Tools

read_fileRead file contents from disk
write_fileWrite or create files on disk
run_commandExecute shell commands
web_searchSearch the web (Google Search grounding)
web_fetchFetch and read a URL
list_directoryList directory contents
grepSearch file contents by pattern

MCP & Config

mcpServers in settings.jsonConfigure MCP servers
~/.gemini/settings.jsonUser-level settings file
.gemini/settings.jsonProject-level settings file
sandbox: trueEnable sandbox mode in config
GOOGLE_CLOUD_PROJECT=...Set Vertex AI project env var
Google Search groundingEnable web-grounded responses

code-agents.oday-bakkour.com · Gemini CLI · Last verified: April 2026