Cheat Sheet
Gemini CLI
Google's AI coding agent for the terminal
Installation & Auth
npm install -g @google/gemini-cliInstall Gemini CLI globallygeminiLaunch interactive REPLgemini auth loginAuthenticate with Google accountGEMINI_API_KEY=...Set API key via environment variablegemini --versionShow installed versionCLI 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 sessionREPL 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 CLIFile & Context
@filenameAttach a file to the prompt@folder/Attach an entire foldergemini --all_filesInclude all repo files in contextGEMINI.mdProject-level instructions file~/.gemini/GEMINI.mdUser-level (global) instructions.geminiignoreExclude files from context (gitignore syntax)1M token context windowFull codebase fits in one requestBuilt-in Tools
read_fileRead file contents from diskwrite_fileWrite or create files on diskrun_commandExecute shell commandsweb_searchSearch the web (Google Search grounding)web_fetchFetch and read a URLlist_directoryList directory contentsgrepSearch file contents by patternMCP & Config
mcpServers in settings.jsonConfigure MCP servers~/.gemini/settings.jsonUser-level settings file.gemini/settings.jsonProject-level settings filesandbox: trueEnable sandbox mode in configGOOGLE_CLOUD_PROJECT=...Set Vertex AI project env varGoogle Search groundingEnable web-grounded responsescode-agents.oday-bakkour.com · Gemini CLI · Last verified: April 2026