GC-101 · Module 5
Complete Command & Configuration Reference
12 min read
This reference covers every slash command, built-in tool, settings key, CLI flag, keyboard shortcut, and authentication method in Gemini CLI. Use it as a lookup table when you need the exact syntax or behavior for a specific feature.
Slash commands are your primary interface for controlling Gemini CLI. They manage sessions, configure settings, inspect state, and trigger workflows.
SESSION MANAGEMENT
/clear Clear conversation history and start fresh
/compact Compress context to free tokens
/restore Restore to a previous checkpoint
/chat View session history, resume, or share sessions
/chat resume Resume a previous conversation
/chat share Export session as markdown or JSON
CONFIGURATION
/settings View and modify all configuration
/init Auto-generate GEMINI.md from codebase
/memory add Add runtime context note
/hooks list List all configured lifecycle hooks
/hooks enable Enable a specific hook
/hooks disable Disable a specific hook
INSPECTION
/help Show all commands and usage
/tools List all available tools (built-in + MCP)
/stats Show token usage statistics
/stats model Show current model and context allocation
OUTPUT
/copy Copy last response to clipboard
Built-in tools are the core capabilities Gemini CLI uses to interact with your codebase and environment. These are always available without any configuration.
FILE OPERATIONS
read_file Read file contents (supports offset/limit for large files)
write_file Write content to a file (creates or overwrites)
edit Apply targeted edits to existing files
list_directory List contents of a directory
glob Find files matching a glob pattern
SEARCH
search_file_content Search file contents with regex (ripgrep-style)
codebase_investigator Deep codebase analysis — traces dependencies, flows, architecture
EXECUTION
run_shell_command Execute a shell command and return output
WEB
google_web_search Search Google for current information
web_fetch Retrieve content from a specific URL
MEMORY
save_memory Persist notes to GEMINI.md
write_todos Create and manage task lists
The settings.json file is the primary configuration mechanism. It lives in .gemini/settings.json for project scope or ~/.gemini/settings.json for global scope. Here are the key configuration fields.
{
"model": "gemini-2.5-pro",
"thinkingBudget": "auto",
"chatCompression": "auto",
"sandbox": "none",
"trustedFolders": ["/home/user/projects/my-app"],
"mcpServers": {},
"includeTools": [],
"excludeTools": [],
"hooks": {}
}
CLI flags control behavior when launching Gemini CLI from the terminal. These override settings.json values for the current session.
CLI FLAGS
gemini Launch interactive mode
gemini -p "prompt" Headless mode — single prompt, no interaction
--output-format json Machine-readable JSON output (headless)
--output-format stream-json Streaming JSON output (headless)
--sandbox docker Run tool executions in Docker container
--sandbox podman Run tool executions in Podman container
--yolo Auto-approve all tool executions (DANGER)
--model <name> Override the default model
--verbose Show detailed execution logs
Keyboard shortcuts for the interactive terminal UI. These work during an active Gemini CLI session.
KEYBOARD SHORTCUTS
Ctrl+L Clear screen (preserves conversation)
Ctrl+G Open $EDITOR for multi-line input
Ctrl+T Toggle tool descriptions in output
Ctrl+C Cancel current generation
Ctrl+D Exit Gemini CLI
Alt+M Toggle markdown rendering
Alt+V Paste image from clipboard
Up/Down Navigate command history
Tab Autocomplete file paths and commands
Authentication methods determine how Gemini CLI connects to Google's Gemini models. Two paths are supported.
AUTHENTICATION
1. Google Account (OAuth)
- Run `gemini` and follow the browser OAuth flow
- Free tier with generous rate limits
- Best for personal use and exploration
2. API Key
- Get a key from aistudio.google.com
- Set GEMINI_API_KEY environment variable
- Best for automation, CI/CD, and higher throughput
- Supports pay-as-you-go for heavy usage