Basic Usage
Interactive REPL
Start Gemini CLI in interactive mode:Non-interactive Query
Execute a query and exit:Piped Content
Process piped content:Execute and Continue Interactively
Execute a query and continue in interactive mode:Resume Sessions
Continue the most recent session:Positional Arguments
Positional prompt. Defaults to one-shot mode. Use
-i/--prompt-interactive to execute and continue interactively.Variadic argument - accepts multiple strings.Global Options
—debug (-d)
Run in debug mode with verbose loggingAlias:
-d—version (-v)
Show CLI version number and exitAlias:
-v—help (-h)
Show help informationAlias:
-hModel Configuration
—model (-m)
Model to use. Accepts either model aliases or concrete model names.Alias:
-mAvailable aliases:auto- Default. Resolves togemini-2.5-proorgemini-3-pro-preview(if preview features enabled)pro- For complex reasoning tasks. Uses preview model if enabled.flash- Fast, balanced model for most tasks (gemini-2.5-flash)flash-lite- Fastest model for simple tasks (gemini-2.5-flash-lite)
gemini-2.5-progemini-3-pro-previewgemini-2.5-flashgemini-2.5-flash-lite
Prompt Options
—prompt (-p)
Prompt text. Appended to stdin input if provided.Alias:
-p—prompt-interactive (-i)
Execute prompt and continue in interactive modeAlias:
-iSession Management
—resume (-r)
Resume a previous session. Use
"latest" for most recent or index number.Alias: -rValues:"latest"- Resume the most recent session<number>- Resume session by index (e.g.,5)<session-id>- Resume session by ID
—list-sessions
List available sessions for the current project and exit
—delete-session
Delete a session by index number. Use
--list-sessions to see available sessions.Security & Permissions
—sandbox (-s)
Run in a sandboxed environment for safer executionAlias:
-s—approval-mode
Approval mode for tool executionChoices:
default- Prompt for approval before executing toolsauto_edit- Auto-approve file edits, prompt for other toolsyolo- Auto-approve all actions
—yolo (-y)
Auto-approve all actionsAlias:
-y—allowed-tools
Tools that are allowed to run without confirmationAccepts comma-separated values or multiple flags.
Workspace Configuration
—include-directories
Additional directories to include in the workspaceAccepts comma-separated values or multiple flags.
Extensions & Integrations
—extensions (-e)
List of extensions to use. If not provided, all extensions are enabled.Alias:
-eAccepts comma-separated values or multiple flags.—list-extensions (-l)
List all available extensions and exitAlias:
-lMCP Configuration
—allowed-mcp-server-names
Allowed MCP server namesAccepts comma-separated values or multiple flags.
Output & Accessibility
—output-format (-o)
The format of the CLI outputAlias:
-oChoices:text- Human-readable text output (default)json- JSON outputstream-json- Streaming JSON output
—screen-reader
Enable screen reader mode for accessibility
Experimental Features
—experimental-acp
Start in ACP (Agent Code Pilot) mode
—experimental-zed-integration
Run in Zed editor integration mode
Update Command
gemini update
Update to the latest version of Gemini CLI:Extensions Command
Manage extensions from the command line:Install Extension
Git URL or local path to the extension
Specific branch, tag, or commit to install
Enable auto-update for the extension
Other Extension Commands
MCP Command
Configure MCP servers from the command line:Add MCP Server
Name for the MCP server
Command to start the stdio-based MCP server
URL for HTTP-based MCP server
Transport type:
stdio or httpEnvironment variables in KEY=value format
Scope:
user or projectComma-separated list of specific tools to include
Other MCP Commands
Skills Command
Manage agent skills from the command line:Skills Commands
Git URL, local path, or file path to the skill
Name of the skill to manage
Local path to link