Basic Commands

Core commands to quickly get started with Gemini CLI

gemini Basic

The main interactive command for conversing with Gemini AI

Syntax

gemini [options] [query]

Common Options

  • --model - Specify which model to use (default: gemini-2.5-pro)
  • --temperature - Control output randomness (0.0-1.0)
  • --max-tokens - Limit output length
  • --help - Show help information

Examples

Basic conversation

gemini "Hello, please introduce yourself"

Specify model

gemini --model gemini-2.5-flash "Quick answer to this question"

gemini auth Authentication

Manage Google account authentication and authorization

Syntax

gemini auth [subcommand]

Subcommands

  • login - Log in to Google account
  • logout - Log out of current account
  • status - Check authentication status

Examples

Log in to account

gemini auth login

Check status

gemini auth status

gemini help Help

Display command help information and documentation

Syntax

gemini help [command]

Examples

Show all commands

gemini help

Show specific command help

gemini help auth

Advanced Commands

Advanced features and complex operations

gemini chat Advanced

Start an interactive chat session with multi-turn dialogue support

Syntax

gemini chat [options]

Options

  • --model - Specify model
  • --system-prompt - Set system prompt
  • --history - Save conversation history

Examples

Start chat

gemini chat

Chat with system prompt

gemini chat --system-prompt "You are a Python expert"

gemini stream Streaming

Stream responses, showing generated content in real-time

Syntax

gemini stream [query]

Examples

Stream generation

gemini stream "Write a Python function"

Chat Commands

Special commands that can be used in interactive chat sessions (prefixed with "/")

/memory Memory Management

Save and manage memories between sessions

Syntax

/memory [subcommand] [content]

Subcommands

  • save - Save a new memory
  • list - List all memories
  • delete - Delete a specific memory

Examples

Save a memory

/memory save "My project uses React 18 and TypeScript 5"

List memories

/memory list

/stats Statistics

View statistics for the current session

Syntax

/stats

Description

Displays token usage information for the current session, including total tokens used and number of requests to different models.

/clear Clear

Clear the current session history

Syntax

/clear

Description

Resets the current session, clearing all history but maintaining authentication.

MCP & Tools

Commands for using Model Context Protocol (MCP) and built-in tools

/mcp MCP Protocol

Connect and manage MCP servers

Syntax

/mcp [subcommand] [url]

Subcommands

  • connect - Connect to an MCP server
  • disconnect - Disconnect from MCP server
  • list - List currently connected MCP servers

Examples

Connect to a server

/mcp connect http://localhost:3000

View connection status

/mcp list

/tools Built-in Tools

Manage and use Gemini's built-in tools

Syntax

/tools [subcommand]

Subcommands

  • list - List all available tools
  • describe - Show details for a specific tool
  • enable - Enable a specific tool
  • disable - Disable a specific tool

Common Built-in Tools

  • grep - Search for patterns in files
  • terminal - Execute shell commands
  • file-read/write - Read and write files
  • web-search - Search the internet for information
  • web-fetch - Download content from URLs

Examples

List tools

/tools list

Use web-search tool

/tools web-search "latest JavaScript framework trends"

File Operations

Commands for reading, analyzing, and processing files

gemini read File

Read and analyze file contents

Syntax

gemini read [file_path] [query]

Options

  • --encoding - Specify file encoding
  • --max-size - Limit file size

Examples

Analyze code file

gemini read app.py "Find issues in this code"

Summarize document

gemini read README.md "Summarize the main features of this project"

gemini write File

Generate content and write to file

Syntax

gemini write [file_path] [query]

Examples

Generate code file

gemini write calculator.py "Create a simple calculator class"

Generate documentation

gemini write API.md "Generate API documentation for this project"

Configuration Commands

Manage Gemini CLI configuration and settings

gemini config Configuration

Manage CLI configuration options

Syntax

gemini config [subcommand] [options]

Subcommands

  • get - Get configuration value
  • set - Set configuration value
  • list - List all configurations
  • reset - Reset configuration

Examples

Set default model

gemini config set default-model gemini-2.5-flash

View configuration

gemini config list

Best Practices

Clear Queries

Use specific, clear queries and avoid vague descriptions

Use Options Wisely

Choose appropriate models and parameters to balance speed and quality

File Operations

Use read and write commands to process files efficiently

Configuration

Configure default settings to reduce repetitive input

Command reference information sourced from Official Gemini CLI Documentation