Gemini CLI Technical Reference Guide
Commands, Keyboard Shortcuts, and Startup Configurations
Table of Contents
- Slash Commands
- Context & Passthrough Commands
- Interactive Keyboard Shortcuts
- Interactive Menus & Dialogs
- CLI Startup Flags
Slash Commands
Slash commands are the primary way to interact with CLI metadata, session state, and global configuration.
| Command | Category | Description |
|---|---|---|
/help (or /?) |
General | Display help for all available commands and usage. |
/about |
General | Show version and system environment info. |
/quit (or /exit) |
General | Exit the CLI. Use --delete to wipe session history. |
/chat | /resume |
Session | Browse auto-saved sessions or manage tagged checkpoints. |
/clear |
UI | Clear the terminal screen and visible history. |
/copy |
Utility | Copy the last model output to the system clipboard. |
/rewind |
History | Navigate backward through interactions (Shortcut: Esc twice). |
/restore |
Recovery | Undo file changes made by the last tool execution. |
/settings |
Config | Open the interactive settings editor. |
/theme |
UI | Open the dialog to change visual themes. |
/vim |
Input | Toggle Vim navigation/editing mode for the input prompt. |
/model |
Config | Manage models or set a specific model (set <name>). |
/plan |
Mode | Switch to Plan Mode or copy the current plan. |
/memory |
Context | Manage hierarchical instructions (add, list, refresh). |
/mcp |
Tools | Manage Model Context Protocol servers. |
/agents |
Tools | Manage local/remote subagents. |
/skills |
Tools | Manage specialized agent workflows. |
/extensions |
Extensibility | Manage CLI extensions (install, uninstall, list). |
/directory |
Workspace | Manage multi-directory workspace support. |
/docs |
General | Open official documentation in the web browser. |
/bug |
Support | File a GitHub issue directly from the CLI. |
Context & Passthrough Commands
These commands allow you to inject local context or interact directly with your system shell.
- At-Commands (
@<path>): Injects file or directory content into your prompt. It respects.gitignoreand.geminiignore. - Shell Commands (
!<command>): Executes the command in your system shell. Typing!alone toggles Shell Mode.
Interactive Keyboard Shortcuts
Basic Controls
| Key | Action |
|---|---|
| Enter | Submit prompt or confirm a dialog selection. |
| Ctrl+C | Cancel request; clear prompt; quit if empty. |
| Ctrl+D | Exit CLI (if input buffer is empty). |
| Esc | Cancel focus, dismiss dialogs, or clear current completion. |
| Ctrl+L | Clear terminal and redraw UI. |
Prompt Navigation & Editing
| Key | Action |
|---|---|
| Ctrl+A / Home | Move cursor to start of line. |
| Ctrl+E / End | Move cursor to end of line. |
| Ctrl+K | Delete from cursor to end of line. |
| Ctrl+U | Delete from cursor to start of line. |
| Ctrl+W | Delete previous word. |
| Ctrl+Z / Alt+Z | Undo last text edit. |
| Ctrl+Shift+Z | Redo last undone edit. |
| Ctrl+P / N | Navigate through prompt history (Previous/Next). |
| Ctrl+R | Start reverse search through prompt history. |
| Ctrl+Enter | Insert a newline without submitting. |
UI & Special Interactions
| Key | Action |
|---|---|
| Tab | Focus Switch: Move focus to active shell. UI: Toggle Minimal/Full UI. |
| Shift+Tab | Move focus back to Gemini; cycle Approval Modes. |
| ? (on empty prompt) | Toggle the shortcuts hint panel. |
| Esc, Esc | Clear prompt or open the Rewind browser if empty. |
| F12 | Toggle debug console (error details). |
| Alt+M | Toggle Markdown rendering. |
| Ctrl+Y | Toggle YOLO mode (auto-approve all tool calls). |
| Ctrl+O | Expand/collapse pasted text placeholders inline. |
| Ctrl+G | Open the current prompt or plan in an external editor. |
Interactive Menus & Dialogs
Several commands trigger interactive UI elements:
- Session Browser (
/resume): Interactive list with search and sorting for past sessions. - Settings Editor (
/settings): A searchable tree-view for allsettings.jsoncategories. - Theme Picker (
/theme): Live-preview list of color schemes. - Auth Dialog (
/auth): UI to switch between API Key, Google Cloud, or Vertex AI auth.
CLI Startup Flags
These flags are used when launching gemini from your terminal.
| Flag | Description |
|---|---|
-m, --model <name> |
Specify the model to use (e.g., gemini-3-flash-preview). |
-p, --prompt <text> |
Non-interactive query mode. |
-i, --prompt-interactive |
Execute an initial prompt and stay in interactive mode. |
-r, --resume <id> |
Resume a session by index, UUID, or latest. |
-s, --sandbox |
Enable Docker/Seatbelt sandboxing for tool execution. |
--approval-mode <mode> |
Set tool safety level: default, auto_edit, yolo, or plan. |
-o, --output-format |
Set to text, json, or stream-json. |
-e, --extensions |
List specific extensions to load (or none). |
Advanced Workflows & Pro-Tips
1. Mastering Plan Mode
Plan Mode is a read-only environment for complex architectural design.
- Model Switching: The CLI uses a Pro model for high-reasoning during planning and a Flash model for fast execution during implementation.
- Workflow: Use
/planto design multi-file changes. You can edit the plan in an external editor (Ctrl+G) before approving it. - Safety: No files are modified while in Plan Mode.
2. Memory Tier Management
The CLI uses a tiered system to balance shared standards with private notes.
- Project Instructions (
GEMINI.md): Shared standards for the whole team (coding style, directory structures). - Private Memory (
MEMORY.md): Local facts specific to your machine or current task (IP addresses, specific credentials). - Global Memory (
~/.gemini/GEMINI.md): Your personal preferences that follow you across all projects.
3. Context & Quota Efficiency
To minimize token usage and preserve your credit/quota:
- Subagent Delegation: Delegate heavy research or batch tasks to subagents. Their internal logs don't bloat your main conversation's history.
- Ignore Files: Use
.geminiignoreto exclude large, irrelevant folders (likenode_modulesordist) from being scanned. - Instruction Stability: Avoid editing
GEMINI.mdfrequently mid-session, as this can invalidate token caches and increase costs.
4. Subagent Specialization
codebase_investigator: Use for deep reverse-engineering or understanding complex dependencies.generalist: Best for "batch" work, like fixing lint errors across 20 files or running verbose test suites.
Gemini CLI Technical Documentation | System Reference | 2026