CLI reference - 186 items
Gemini CLI reference
Gemini CLI documents 41 slash commands, 31 CLI flags, 28 subcommands, 15 keyboard shortcuts, 23 settings keys, 33 environment variables and 15 config files. This page lists all 186 with what each one does, the values it accepts and a working example where the docs give one.
Last verified 17 official pagesRun as gemini
Slash commands41
Own page: Gemini CLI slash commands| Command | Description | Example |
|---|---|---|
/about | Show version info. Share this information when filing issues. Docs: /about | -no example |
/agents | Manage local and remote subagents. sub-commands: list, reload (alias refresh), enable, disable, config Docs: /agents | /agents config <agent-name> |
/auth | Open a dialog that lets you change the authentication method. Docs: /auth | -no example |
/bug | File an issue about Gemini CLI; the text after /bug becomes the headline. Configurable via advanced.bugCommand. Docs: /bug | -no example |
/chat | Alias for /resume, exposing the same session browser and checkpoint subcommands. sub-commands: debug, delete <tag>, list, resume <tag>, save <tag>, share [filename] Docs: /chat | /chat share file.md |
/clear | Clear the conversation context and start a new session, also clearing the terminal screen and scrollback. Docs: /clear | -no example |
/commands | Manage custom slash commands loaded from .toml files. sub-commands: list, reload Docs: /commands | /commands reload |
/compress | Replace the entire chat context with a summary to save tokens. Docs: /compress | -no example |
/copy | Copies the last output produced by Gemini CLI to your clipboard. Docs: /copy | -no example |
/directory | Manage workspace directories for multi-directory support. alias: /dir; sub-commands: add, show Docs: /directory | /directory add <path1>,<path2> |
/docs | Open Gemini CLI documentation in your browser. Docs: /docs | -no example |
/editor | Open a dialog for selecting supported editors. Docs: /editor | -no example |
/extensions | Manage extensions. sub-commands: config, disable, enable, explore, install, link, list, restart, uninstall, update Docs: /extensions | -no example |
/help | Display help information about Gemini CLI, including available commands. alias: /? Docs: /help | -no example |
/hooks | Manage hooks that intercept and customize behavior at lifecycle events. sub-commands: disable-all, disable <hook-name>, enable-all, enable <hook-name>, list (show, panel) Docs: /hooks | -no example |
/ide | Manage IDE integration. sub-commands: disable, enable, install, status Docs: /ide | -no example |
/init | Analyzes the current directory and generates a tailored GEMINI.md context file. Docs: /init | -no example |
/mcp | Manage configured MCP servers; list is the default action. sub-commands: auth, desc, disable, enable, list (ls), reload, schema Docs: /mcp | /mcp auth <server-name> |
/memory | Manage hierarchical instructional memory loaded from GEMINI.md files. sub-commands: list, refresh, reload, show, inbox Docs: /memory | /memory show |
/model | Manage model configuration. sub-commands: manage, set Docs: /model | /model set <model-name> [--persist] |
/permissions | Manage folder trust settings and other permissions. sub-commands: trust Docs: /permissions | /permissions trust [<directory-path>] |
/plan | Switch to read-only Plan Mode and view the current plan; an optional goal is submitted immediately. sub-commands: copy; disable via general.plan.enabled Docs: /plan | /plan implement authentication |
/policies | Manage policies; list shows all active policies grouped by mode. sub-commands: list Docs: /policies | -no example |
/privacy | Display the Privacy Notice and select data-collection consent. Docs: /privacy | -no example |
/quit | Exit Gemini CLI. --delete also permanently deletes the current session's history and temporary files. alias: /exit; flags: --delete Docs: /quit | /quit --delete |
/restore | Restore project files to the state before a tool ran; lists checkpoints when run without an ID. Requires checkpointing. Docs: /restore | /restore [tool_call_id] |
/rewind | Navigate backward through conversation history, optionally reverting chat state and file changes. shortcut: press Esc twice Docs: /rewind | -no example |
/resume | Browse and resume auto-saved sessions and manage manual chat checkpoints. alias: /chat; sub-commands: list, save <tag>, resume <tag> (load), delete <tag>, share [filename], debug Docs: /resume | -no example |
/settings | Open the settings editor to view and modify settings with validation. Docs: /settings | /settings |
/shells | Toggle the background shells view for long-running processes. alias: /bashes Docs: /shells | -no example |
/setup-github | Set up GitHub Actions to triage issues and review PRs with Gemini. Docs: /setup-github | -no example |
/skills | Manage Agent Skills. sub-commands: disable <name>, enable <name>, list [all] [nodesc], link <path> [--scope user|workspace], reload (refresh) Docs: /skills | /skills enable <name> |
/stats | Display detailed statistics for the current session. sub-commands: session (default), model, tools Docs: /stats | -no example |
/terminal-setup | Configure terminal keybindings for multiline input (VS Code, Cursor, Windsurf). Docs: /terminal-setup | -no example |
/theme | Open a dialog to change the visual theme. Docs: /theme | -no example |
/tools | Display the list of currently available tools. sub-commands: desc (descriptions), nodesc (nodescriptions) Docs: /tools | /tools [desc] |
/upgrade | Open the Gemini Code Assist upgrade page. Only available when logged in with Google. Docs: /upgrade | -no example |
/vim | Toggle vim mode with NORMAL and INSERT modes; the preference persists in ~/.gemini/settings.json. Docs: /vim | -no example |
/gemma | In-session status panel for local Gemma model routing. Docs: /gemma | /gemma |
@<path_to_file_or_directory> | Inject file content into the prompt (directories are passed for the model to inspect); git-ignored files excluded by default. escape spaces with a backslash Docs: @<path_to_file_or_directory> | @path/to/your/file.txt Explain this text. |
!<shell_command> | Run a shell command (bash, or powershell.exe on Windows); a lone ! toggles shell mode. Sets GEMINI_CLI=1 in the subprocess. Docs: !<shell_command> | !git status |
CLI flags31
Own page: Gemini CLI CLI flags| Flag | Description | Example |
|---|---|---|
--debug, -d | Run in debug mode with verbose logging. Open the debug console with F12 to see the additional logging. boolean; default: false Docs: --debug, -d | -no example |
--version, -v | Show CLI version number and exit. Docs: --version, -v | gemini --version |
--help, -h | Show help information about command-line arguments. Docs: --help, -h | -no example |
--model, -m | Model to use for this session. Accepts aliases (auto, pro, flash, flash-lite) or concrete model names. string; default: auto Docs: --model, -m | -no example |
--prompt, -p | Prompt text, appended to stdin input if provided. Forces non-interactive mode. string Docs: --prompt, -p | gemini -p "summarize README.md" |
--prompt-interactive, -i | Execute the prompt and continue in interactive mode. Cannot be used when piping input from stdin. string Docs: --prompt-interactive, -i | gemini -i "What is the purpose of this project?" |
--worktree, -w | Start Gemini in a new git worktree; a name is generated if none is given. Requires experimental.worktrees: true. string (optional name) Docs: --worktree, -w | gemini --worktree feature-search |
--sandbox, -s | Run in a sandboxed environment for safer execution. boolean; default: false Docs: --sandbox, -s | gemini -s -p "analyze the code structure" |
--skip-trust | Trust the current workspace for this session, skipping the folder trust check. boolean; default: false Docs: --skip-trust | -no example |
--approval-mode | Approval mode for tool execution: default prompts, auto_edit auto-approves edit tools, yolo auto-approves all, plan is read-only. Cannot be combined with --yolo. string; choices: default, auto_edit, yolo, plan; default: default Docs: --approval-mode | gemini --approval-mode auto_edit |
--yolo, -y | Deprecated. Auto-approve all actions; use --approval-mode=yolo instead. boolean; default: false Docs: --yolo, -y | -no example |
--acp | Starts the agent in Agent Client Protocol (ACP) mode, JSON-RPC over stdio for IDE and tool integrations. boolean Docs: --acp | gemini --acp |
--experimental-acp | Start in ACP mode. Experimental feature. boolean Docs: --experimental-acp | -no example |
--experimental-zed-integration | Run in Zed editor integration mode. Experimental feature. boolean Docs: --experimental-zed-integration | -no example |
--allowed-mcp-server-names | Allowed MCP server names for the session (comma-separated or multiple flags). array Docs: --allowed-mcp-server-names | -no example |
--allowed-tools | Deprecated; use the Policy Engine instead. Tools allowed to run without confirmation. array Docs: --allowed-tools | gemini --allowed-tools "ShellTool(git status)" |
--extensions, -e | List of extensions to use; all are enabled if omitted. Use -e none to disable all extensions. array Docs: --extensions, -e | gemini -e my-extension -e my-other-extension |
--list-extensions, -l | List all available extensions and exit. boolean Docs: --list-extensions, -l | -no example |
--resume, -r | Resume a previous session by "latest", index number, or session UUID; defaults to "latest". string Docs: --resume, -r | gemini --resume 5 |
--list-sessions | List available sessions for the current project and exit. boolean Docs: --list-sessions | gemini --list-sessions |
--delete-session | Delete a session by index number or full session UUID. string Docs: --delete-session | gemini --delete-session 3 |
--include-directories | Additional workspace directories (comma-separated or multiple flags). 5 directories can be added at maximum. array Docs: --include-directories | --include-directories /path/to/project1,/path/to/project2 |
--screen-reader | Enable screen reader mode for accessibility. boolean Docs: --screen-reader | -no example |
--output-format, -o | Output format for non-interactive mode. string; choices: text, json, stream-json; default: text Docs: --output-format, -o | -no example |
--fake-responses | Path to a file with fake model responses for testing. string (path) Docs: --fake-responses | -no example |
--record-responses | Path to a file to record model responses for testing. string (path) Docs: --record-responses | -no example |
--admin-policy | Supplemental admin policy path; ignored if .toml policy files exist in the standard system location. string (path) Docs: --admin-policy | -no example |
query (positional) | Positional prompt. Defaults to interactive mode in a TTY; use -p/--prompt for non-interactive execution. string (variadic) Docs: query (positional) | gemini "explain this project" |
gemini mcp add --scope, -s | Configuration scope: user (~/.gemini/settings.json) or project (.gemini/settings.json). user or project; default: "project" Docs: gemini mcp add --scope, -s | gemini mcp add db node db-server.js --scope user |
gemini mcp add --transport, -t | Transport type for the server. stdio, sse, http; default: "stdio" Docs: gemini mcp add --transport, -t | gemini mcp add --transport http http-server https://api.example.com/mcp/ |
gemini extensions install --ref | The git ref (branch, tag, or commit) to install. Docs: gemini extensions install --ref | gemini extensions install https://github.com/user/my-extension --ref develop |
Subcommands28
Own page: Gemini CLI subcommands| Command | Description | Example |
|---|---|---|
gemini update | Update to the latest version. Docs: gemini update | gemini update |
gemini extensions install | Install an extension from a GitHub URL or local path. <source> [--ref <ref>] [--auto-update] [--pre-release] [--consent] [--skip-settings] Docs: gemini extensions install | gemini extensions install https://github.com/user/my-extension |
gemini extensions uninstall | Uninstall one or more extensions. <name...> Docs: gemini extensions uninstall | gemini extensions uninstall my-extension |
gemini extensions list | List all installed extensions. Docs: gemini extensions list | gemini extensions list |
gemini extensions update | Update an extension, or all extensions with --all. <name> | --all Docs: gemini extensions update | gemini extensions update --all |
gemini extensions enable | Re-enable a disabled extension. <name> [--scope user|workspace] Docs: gemini extensions enable | gemini extensions enable my-extension |
gemini extensions disable | Disable an extension entirely or for a specific workspace. <name> [--scope user|workspace] Docs: gemini extensions disable | gemini extensions disable my-extension |
gemini extensions link | Symlink a local development directory into the extensions directory. <path> Docs: gemini extensions link | gemini extensions link /path/to/extension |
gemini extensions new | Create a new extension from a built-in template (for example mcp-server, context, custom-commands). <path> [template] Docs: gemini extensions new | gemini extensions new ./my-extension |
gemini extensions validate | Validate extension structure. <path> Docs: gemini extensions validate | gemini extensions validate ./my-extension |
gemini extensions config | Update an extension's settings. <name> [setting] [--scope <scope>] Docs: gemini extensions config | -no example |
gemini mcp add | Add an MCP server to user or project settings.json. Options: -s/--scope, -t/--transport, -e/--env, -H/--header, --timeout, --trust, --description, --include-tools, --exclude-tools. [options] <name> <commandOrUrl> [args...] Docs: gemini mcp add | gemini mcp add github npx -y @modelcontextprotocol/server-github |
gemini mcp list | List configured MCP servers with configuration and connection status. Has no flags. Docs: gemini mcp list | gemini mcp list |
gemini mcp remove | Delete a server from the mcpServers object in settings.json. <name> [-s, --scope] Docs: gemini mcp remove | gemini mcp remove my-server |
gemini mcp enable | Re-enable a disabled MCP server; --session applies only to this session. <name> [--session] Docs: gemini mcp enable | gemini mcp enable <name> [--session] |
gemini mcp disable | Temporarily disable an MCP server without removing its configuration. <name> [--session] Docs: gemini mcp disable | gemini mcp disable <name> [--session] |
gemini skills list | List all discovered agent skills. Docs: gemini skills list | gemini skills list |
gemini skills install | Install a skill from Git, a path, or a file. <source> [--scope] [--path] [--consent] Docs: gemini skills install | gemini skills install https://github.com/user/repo.git --consent |
gemini skills link | Link local agent skills via symlink. <path> Docs: gemini skills link | gemini skills link /path/to/my-skills |
gemini skills uninstall | Uninstall an agent skill. <name> [--scope user|workspace] Docs: gemini skills uninstall | gemini skills uninstall my-skill --scope workspace |
gemini skills enable | Enable an agent skill, or all skills with --all. <name> | --all Docs: gemini skills enable | gemini skills enable --all |
gemini skills disable | Disable an agent skill, or all skills with --all. <name> | --all Docs: gemini skills disable | gemini skills disable my-skill |
gemini trust | Trust the current folder, so stdio MCP servers are tested and shown as Connected. Docs: gemini trust | -no example |
gemini gemma setup | Full local Gemma routing install (binary, model, settings, server start). Flags: --port, --no-start, --force, --skip-model. [--port] [--no-start] [--force] [--skip-model] Docs: gemini gemma setup | gemini gemma setup --port 8080 # custom port |
gemini gemma status | Health check showing what is installed and running. Docs: gemini gemma status | -no example |
gemini gemma start | Start the LiteRT server (auto-starts on CLI launch by default). Docs: gemini gemma start | -no example |
gemini gemma stop | Stop the LiteRT server. Docs: gemini gemma stop | -no example |
gemini gemma logs | Tail the server logs to see routing requests live. Docs: gemini gemma logs | -no example |
Keyboard shortcuts15
Own page: Gemini CLI keyboard shortcuts| Shortcut | Description |
|---|---|
basic.quit | Cancel the current request or quit the CLI when input is empty. default keys: Ctrl+C Docs: basic.quit |
basic.exit | Exit the CLI when the input buffer is empty. default keys: Ctrl+D Docs: basic.exit |
history.search.start | Start reverse search through history. default keys: Ctrl+R Docs: history.search.start |
input.newline | Insert a newline without submitting. default keys: Ctrl+Enter, Cmd/Win+Enter, Alt+Enter, Shift+Enter, Ctrl+J Docs: input.newline |
input.queueMessage | Queue the current prompt to run after the current task finishes. default keys: Tab Docs: input.queueMessage |
input.openExternalEditor | Open the current prompt or the plan in an external editor. default keys: Ctrl+G, Ctrl+Shift+G Docs: input.openExternalEditor |
app.showErrorDetails | Toggle the debug console for detailed error information. default keys: F12 Docs: app.showErrorDetails |
app.showFullTodos | Toggle the full TODO list. default keys: Ctrl+T Docs: app.showFullTodos |
app.toggleYolo | Toggle YOLO (auto-approval) mode for tool calls. default keys: Ctrl+Y Docs: app.toggleYolo |
app.cycleApprovalMode | Cycle approval modes: default, auto_edit, plan (plan skipped when the agent is busy). default keys: Shift+Tab Docs: app.cycleApprovalMode |
app.clearScreen | Clear the terminal screen and redraw the UI (keeps conversation context). default keys: Ctrl+L Docs: app.clearScreen |
app.toggleMarkdown | Toggle Markdown rendering. default keys: Alt+M Docs: app.toggleMarkdown |
background.toggle | Toggle current background shell visibility. default keys: Ctrl+B Docs: background.toggle |
Esc Esc | Pressed twice quickly: clear the input if not empty, otherwise browse and rewind previous interactions. Docs: Esc Esc |
? on an empty prompt | Toggle the shortcuts panel above the input. Docs: ? on an empty prompt |
Settings23
Own page: Gemini CLI settings keys| Key | Description |
|---|---|
general.defaultApprovalMode | Default approval mode for tool execution. YOLO can only be enabled via the command line. enum; default: "default"; values: "default", "auto_edit", "plan" Docs: general.defaultApprovalMode |
general.vimMode | Enable Vim keybindings. boolean; default: false Docs: general.vimMode |
general.checkpointing.enabled | Enable session checkpointing for recovery. boolean; default: false; restart required Docs: general.checkpointing.enabled |
general.plan.enabled | Enable Plan Mode for read-only safety during planning. boolean; default: true; restart required Docs: general.plan.enabled |
general.sessionRetention.maxAge | Automatically delete chats older than this period (e.g. "30d", "7d", "24h", "1w"). string; default: "30d" Docs: general.sessionRetention.maxAge |
ui.theme | The color theme for the UI. string; default: undefined Docs: ui.theme |
model.name | The Gemini model to use for conversations. string; default: undefined Docs: model.name |
model.maxSessionTurns | Maximum user/model/tool turns to keep in a session; -1 means unlimited. number; default: -1 Docs: model.maxSessionTurns |
model.compressionThreshold | Fraction of context usage at which to trigger context compression. number; default: 0.5; restart required Docs: model.compressionThreshold |
context.fileName | Name of the context file or files to load into memory. string | string[]; default: undefined Docs: context.fileName |
tools.sandbox | Legacy full-process sandbox: boolean, profile path, or command (e.g. "docker", "podman", "lxc", "windows-native"). string; default: undefined; restart required Docs: tools.sandbox |
tools.allowed | Tool names that bypass the confirmation dialog. array; default: undefined; restart required Docs: tools.allowed |
tools.exclude | Tool names to exclude from discovery. array; default: undefined; restart required Docs: tools.exclude |
security.folderTrust.enabled | Whether Folder trust is enabled. boolean; default: true; restart required Docs: security.folderTrust.enabled |
security.disableYoloMode | Disable YOLO mode, even if enabled by a flag. boolean; default: false; restart required Docs: security.disableYoloMode |
advanced.excludedEnvVars | Environment variables to exclude from project context. array; default: ["DEBUG", "DEBUG_MODE"] Docs: advanced.excludedEnvVars |
experimental.worktrees | Enable automated Git worktree management for parallel work. boolean; default: false; restart required Docs: experimental.worktrees |
skills.enabled | Enable Agent Skills. boolean; default: true; restart required Docs: skills.enabled |
hooksConfig.enabled | Canonical toggle for the hooks system; when disabled, no hooks run. boolean; default: true; restart required Docs: hooksConfig.enabled |
hooks.BeforeTool | Hooks that run before tool execution. Other events: AfterTool, BeforeAgent, AfterAgent, Notification, SessionStart, SessionEnd, PreCompress, BeforeModel, AfterModel, BeforeToolSelection. array; default: [] Docs: hooks.BeforeTool |
mcpServers.<SERVER_NAME> | Named MCP server config. Fields: command, args, env, cwd, url (SSE), httpUrl, headers, timeout, trust, description, includeTools, excludeTools. object; precedence httpUrl > url > command Docs: mcpServers.<SERVER_NAME> |
telemetry.* | Telemetry settings: enabled, traces, target, otlpEndpoint, otlpProtocol, otlpHeaders, logPrompts, outfile, useCollector, useCliAuth. target: local|gcp (default local); otlpEndpoint default http://localhost:4317; otlpProtocol grpc|http (default grpc) Docs: telemetry.* |
admin.secureModeEnabled | If true, disallows YOLO mode and "Always allow" options. boolean; default: false Docs: admin.secureModeEnabled |
Environment variables33
Own page: Gemini CLI environment variables| Variable | Description | Example |
|---|---|---|
GEMINI_API_KEY | Your API key for the Gemini API. Docs: GEMINI_API_KEY | -no example |
GEMINI_MODEL | Specifies the default Gemini model, overriding the hardcoded default. Docs: GEMINI_MODEL | export GEMINI_MODEL="gemini-3-flash-preview" |
GEMINI_CLI_TRUST_WORKSPACE | If "true", trusts the current workspace for the session, bypassing the folder trust check. "true" Docs: GEMINI_CLI_TRUST_WORKSPACE | -no example |
GEMINI_CLI_TRUSTED_FOLDERS_PATH | Overrides the default location of trustedFolders.json. path Docs: GEMINI_CLI_TRUSTED_FOLDERS_PATH | -no example |
GEMINI_CLI_IDE_PID | Manually specifies the IDE process PID for integration, overriding auto-detection. PID Docs: GEMINI_CLI_IDE_PID | -no example |
GEMINI_CLI_HOME | Root directory for user-level configuration and storage; a .gemini folder is created inside it. path; default: user home Docs: GEMINI_CLI_HOME | export GEMINI_CLI_HOME="/path/to/user/config" |
GEMINI_CLI_SURFACE | Custom label included in the User-Agent header for API traffic reporting. string Docs: GEMINI_CLI_SURFACE | export GEMINI_CLI_SURFACE="my-custom-tool" |
GEMINI_CLI_SYSTEM_DEFAULTS_PATH | Overrides the path of the system defaults settings file. path Docs: GEMINI_CLI_SYSTEM_DEFAULTS_PATH | -no example |
GEMINI_CLI_SYSTEM_SETTINGS_PATH | Overrides the path of the system settings (override) file. path Docs: GEMINI_CLI_SYSTEM_SETTINGS_PATH | -no example |
GOOGLE_API_KEY | Google Cloud API key; required for Vertex AI express mode. Docs: GOOGLE_API_KEY | export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY" |
GOOGLE_CLOUD_PROJECT | Google Cloud Project ID; required for Code Assist or Vertex AI. Docs: GOOGLE_CLOUD_PROJECT | export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" |
GOOGLE_CLOUD_LOCATION | Google Cloud location (for example us-central1); required for Vertex AI non-express mode. Docs: GOOGLE_CLOUD_LOCATION | export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION" |
GOOGLE_APPLICATION_CREDENTIALS | Path to your Google Application Credentials JSON file. string (path) Docs: GOOGLE_APPLICATION_CREDENTIALS | export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/credentials.json" |
GOOGLE_GENAI_API_VERSION | API version for Gemini API requests, overriding the SDK default. Docs: GOOGLE_GENAI_API_VERSION | export GOOGLE_GENAI_API_VERSION="v1" |
GOOGLE_GEMINI_BASE_URL | Overrides the Gemini API base URL (gemini-api-key auth); must be HTTPS unless localhost. URL Docs: GOOGLE_GEMINI_BASE_URL | export GOOGLE_GEMINI_BASE_URL="https://my-proxy.com" |
GOOGLE_VERTEX_BASE_URL | Overrides the Vertex AI base URL (vertex-ai auth); must be HTTPS unless localhost. URL Docs: GOOGLE_VERTEX_BASE_URL | export GOOGLE_VERTEX_BASE_URL="https://my-vertex-proxy.com" |
OTLP_GOOGLE_CLOUD_PROJECT | Google Cloud Project ID for telemetry in Google Cloud. Docs: OTLP_GOOGLE_CLOUD_PROJECT | export OTLP_GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" |
GEMINI_TELEMETRY_ENABLED | true or 1 enables telemetry; overrides telemetry.enabled. Related overrides: GEMINI_TELEMETRY_TRACES_ENABLED, _TARGET, _OTLP_ENDPOINT, _OTLP_PROTOCOL, _OTLP_HEADERS, _LOG_PROMPTS, _OUTFILE, _USE_COLLECTOR, _USE_CLI_AUTH. true/1 Docs: GEMINI_TELEMETRY_ENABLED | -no example |
GEMINI_SANDBOX | Alternative to the sandbox setting; enables sandboxing. true, false, docker, podman, sandbox-exec, runsc, lxc, or a custom command Docs: GEMINI_SANDBOX | export GEMINI_SANDBOX=docker |
GEMINI_SANDBOX_IMAGE | Custom container image to use for sandboxing. image name Docs: GEMINI_SANDBOX_IMAGE | export GEMINI_SANDBOX_IMAGE="us-central1-docker.pkg.dev/my-project/my-repo/my-custom-sandbox:latest" |
BUILD_SANDBOX | Builds a custom sandbox image from .gemini/sandbox.Dockerfile. 1 Docs: BUILD_SANDBOX | BUILD_SANDBOX=1 GEMINI_SANDBOX=docker gemini -p "run my custom build" |
SANDBOX_MOUNTS | Comma-separated from:to:opts mounts giving the sandbox access outside the workspace; opts defaults to ro. from:to:opts list Docs: SANDBOX_MOUNTS | export SANDBOX_MOUNTS="/path/on/host:/path/in/container:rw,/another/path:ro" |
SANDBOX_FLAGS | Custom flags injected into the docker or podman command. string Docs: SANDBOX_FLAGS | export SANDBOX_FLAGS="--security-opt label=disable" |
SEATBELT_PROFILE | Switches the macOS Seatbelt (sandbox-exec) profile. permissive-open (default), permissive-proxied, restrictive-open, restrictive-proxied, strict-open, strict-proxied, or a custom <profile_name> Docs: SEATBELT_PROFILE | -no example |
GEMINI_SYSTEM_MD | Replaces the built-in system prompt with a Markdown file; true/1 uses ./.gemini/system.md, other strings are paths. true/1, false/0, or a path Docs: GEMINI_SYSTEM_MD | -no example |
GEMINI_WRITE_SYSTEM_MD | Writes the built-in system prompt to a file for review; true/1 writes ./.gemini/system.md. true/1 or a path Docs: GEMINI_WRITE_SYSTEM_MD | -no example |
DEBUG / DEBUG_MODE | true or 1 enables verbose debug logging; excluded from project .env files by default. true/1 Docs: DEBUG / DEBUG_MODE | -no example |
NO_COLOR | Set to any value to disable all color output. any value Docs: NO_COLOR | -no example |
CLI_TITLE | Customizes the title of the CLI. string Docs: CLI_TITLE | -no example |
CODE_ASSIST_ENDPOINT | Endpoint for the code assist server, for development and testing. URL Docs: CODE_ASSIST_ENDPOINT | -no example |
GEMINI_CLI | Set to 1 in subprocesses run via ! or shell mode so scripts can detect Gemini CLI. 1 Docs: GEMINI_CLI | -no example |
GEMINI_PROJECT_DIR | Hook environment: absolute path to the project root. Hooks also get GEMINI_PLANS_DIR, GEMINI_SESSION_ID, GEMINI_CWD and CLAUDE_PROJECT_DIR (alias). Docs: GEMINI_PROJECT_DIR | -no example |
NODE_USE_SYSTEM_CA | Set to 1 to make Node.js use the system certificate store (corporate TLS fix); alternative is NODE_EXTRA_CA_CERTS. 1 Docs: NODE_USE_SYSTEM_CA | export NODE_USE_SYSTEM_CA=1 |
Config files15
Own page: Gemini CLI config files| Path | Description |
|---|---|
~/.gemini/settings.json | User settings file; applies to all sessions for the current user. Docs: ~/.gemini/settings.json |
.gemini/settings.json | Project settings file; overrides user settings and system defaults. Docs: .gemini/settings.json |
/etc/gemini-cli/system-defaults.json | System defaults file (lowest precedence). macOS: /Library/Application Support/GeminiCli/system-defaults.json; Windows: C:\ProgramData\gemini-cli\system-defaults.json. Docs: /etc/gemini-cli/system-defaults.json |
/etc/gemini-cli/settings.json | System settings file that overrides all other settings files. macOS and Windows equivalents under GeminiCli / ProgramData. Docs: /etc/gemini-cli/settings.json |
.env / .gemini/.env | .env is searched from the cwd up to project root or home, then ~/.env. Variables from .gemini/.env are never excluded. Docs: .env / .gemini/.env |
~/.gemini/trustedFolders.json | Central store of folder trust decisions. Docs: ~/.gemini/trustedFolders.json |
~/.gemini/keybindings.json | JSON array of {command, key|keys} entries; prefix a command with - to unbind. Docs: ~/.gemini/keybindings.json |
GEMINI.md | Default hierarchical context file (global ~/.gemini/GEMINI.md plus project files); name configurable via context.fileName. Docs: GEMINI.md |
.geminiignore | Excludes files and directories from Gemini CLI tools, similar to .gitignore. Docs: .geminiignore |
~/.gemini/commands/ and <project>/.gemini/commands/ | Custom command .toml files; project commands override user commands with the same name. Docs: ~/.gemini/commands/ and <project>/.gemini/commands/ |
~/.gemini/skills/ and .gemini/skills/ | User skills (alias ~/.agents/skills/) and workspace skills directories. Docs: ~/.gemini/skills/ and .gemini/skills/ |
~/.gemini/policies/*.toml | User-tier policy files. Admin tier: /etc/gemini-cli/policies (Linux); workspace tier currently disabled. Docs: ~/.gemini/policies/*.toml |
gemini-extension.json | Extension manifest in ~/.gemini/extensions/<name>/ (name, version, mcpServers, contextFileName, excludeTools, settings). Docs: gemini-extension.json |
~/.gemini/mcp-server-enablement.json | Stores MCP server enablement state. Docs: ~/.gemini/mcp-server-enablement.json |
.gemini/sandbox.Dockerfile | Custom sandbox Dockerfile, built when BUILD_SANDBOX is set. Docs: .gemini/sandbox.Dockerfile |
More on Gemini CLI
Related reading
- Do Your Agent Hooks Fail Open? Claude Code vs Codex vs Cursor vs Gemini CLIA guard hook that crashes, times out or points at a missing script lets the tool call through by default in Claude Code. v2.1.295 adds onFailure: block. Here is what each coding agent does when your policy hook breaks, with real test runs.
- How to Keep API Keys Away From Your AI Coding Agent: Claude Code vs Codex vs Cursor vs Gemini CLIA deny rule on .env stops cat but not a Python one-liner. Here are the three layers that actually keep secrets out of a coding agent's context - file rules, environment scrubbing and credential masking - and what Claude Code, Codex, Cursor and Gemini CLI give you for each, with real test runs.
- Headless AI Coding Agents in CI: Claude Code, Codex CLI, Gemini CLI, and opencode ComparedHeadless AI coding agents in CI compared: Claude Code, Codex CLI, Gemini CLI, and opencode on invocation flags, sandboxing, auth, and output formats.
- Gemini CLI to Antigravity CLI Migration Guide: The June 18 DeadlineGemini CLI to Antigravity CLI migration guide: install, migrate config, update scripts and CI, and avoid the silent MCP failure that breaks tool calls.
FAQ
How many commands and options does Gemini CLI have?
The official Gemini CLI docs list 186 items: 41 slash commands, 31 CLI flags, 28 subcommands, 15 keyboard shortcuts, 23 settings keys, 33 environment variables and 15 config files. The largest group is slash commands, with 41.
Where does Gemini CLI keep its configuration?
Gemini CLI documents 15 config files and locations, including ~/.gemini/settings.json, .gemini/settings.json and /etc/gemini-cli/system-defaults.json. The docs describe ~/.gemini/settings.json as: User settings file; applies to all sessions for the current user.
Which environment variables does Gemini CLI read?
The docs list 33 environment variables, such as GEMINI_API_KEY, GEMINI_MODEL, GEMINI_CLI_TRUST_WORKSPACE and GEMINI_CLI_TRUSTED_FOLDERS_PATH. Each one is in the environment variables table above with what it controls.
Sources
Last verified . Names and examples are copied verbatim from the 17 official pages below, and every row above links the exact section it came from.
- github.com/google-gemini/gemini-cli/blob/main/docs/cli/cli-reference.md31 items
- github.com/google-gemini/gemini-cli/blob/main/docs/cli/acp-mode.md1 item
- github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md54 items
- github.com/google-gemini/gemini-cli/blob/main/docs/reference/policy-engine.md2 items
- github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md9 items
- github.com/google-gemini/gemini-cli/blob/main/docs/extensions/reference.md10 items
- github.com/google-gemini/gemini-cli/blob/main/docs/cli/skills.md3 items
- github.com/google-gemini/gemini-cli/blob/main/docs/core/gemma-setup.md6 items
- github.com/google-gemini/gemini-cli/blob/main/docs/reference/commands.md41 items
- github.com/google-gemini/gemini-cli/blob/main/docs/cli/telemetry.md2 items
- github.com/google-gemini/gemini-cli/blob/main/docs/cli/sandbox.md6 items
- github.com/google-gemini/gemini-cli/blob/main/docs/hooks/index.md1 item
- github.com/google-gemini/gemini-cli/blob/main/docs/resources/troubleshooting.md1 item
- github.com/google-gemini/gemini-cli/blob/main/docs/cli/trusted-folders.md1 item
- github.com/google-gemini/gemini-cli/blob/main/docs/reference/keyboard-shortcuts.md16 items
- github.com/google-gemini/gemini-cli/blob/main/docs/cli/gemini-ignore.md1 item
- github.com/google-gemini/gemini-cli/blob/main/docs/cli/custom-commands.md1 item
Newsletter
Know when your tools change
One email per week. New coding agent releases, the flags and commands they add, and what they mean for how you work.