Skip to main content
Gemini CLI supports three types of built-in commands to help you manage sessions, include context, and execute shell commands. Commands are prefixed with / (slash), @ (at), or ! (exclamation mark).

Command Types

Slash Commands

Meta-level control over the CLI itself

At References

Include file and directory content in prompts

Shell Mode

Execute system commands directly

Slash Commands (/)

Slash commands provide meta-level control over Gemini CLI functionality.

Session Management

Opens an interactive session browser where you can:
  • Search through conversation history across all sessions (press /)
  • Sort sessions by date or message count
  • Delete unwanted sessions
  • Resume any previous conversation
All conversations are automatically saved as you chat.See Session Management for complete details.
Save and resume conversation history for branching state.Sub-commands:
  • save <tag> - Save current conversation with a tag
  • resume <tag> - Resume a saved conversation
  • list - List available tags (project-scoped)
  • delete <tag> - Delete a saved checkpoint
  • share [filename] - Export conversation to Markdown or JSON
  • debug - Export most recent API request as JSON
Checkpoints are stored in:
  • Linux/macOS: ~/.gemini/tmp/<project_hash>/
  • Windows: C:\Users\<YourUsername>\.gemini\tmp\<project_hash>\
Navigate backward through conversation history to review or revert changes.Keyboard shortcut: Press Esc twiceFeatures:
  • Preview user prompts and file changes
  • Choose to rewind history only, revert code only, or both
Restore project files to their state before a tool was executed.Usage: /restore [tool_call_id]Run without arguments to list available checkpoints.
Only available when checkpointing is enabled. See Checkpointing for details.

Configuration & Settings

Opens an interactive editor to view and modify Gemini CLI settings.Equivalent to editing .gemini/settings.json with validation and guidance.See Configuration for available settings.
Sub-commands:
  • manage - Opens dialog to configure the model
  • set <model-name> [--persist] - Set the model to use
Opens a dialog to change the visual theme of Gemini CLI.
Toggle vim-style navigation and editing commands.Features:
  • Count support: 3h, 5w, 10G
  • Editing: x, c, i, a, o, O, dd, cc, dw, cw
  • Navigation: h, j, k, l, w, b, e, 0, $, ^, G, gg
  • Repeat: . to repeat last operation
  • Modes: [NORMAL] and [INSERT] shown in footer

Context & Memory

Manage hierarchical memory loaded from GEMINI.md files.Sub-commands:
  • add <text> - Add text to AI’s memory
  • list - List paths of GEMINI.md files in use
  • show - Display full concatenated memory content
  • refresh - Reload from all GEMINI.md files
Manage multi-directory workspaces.Sub-commands:
  • add <path1>,<path2> - Add directories (absolute, relative, or ~)
  • show - Display all added directories
Disabled in restrictive sandbox profiles. Use --include-directories when starting instead.
Analyzes the current directory and generates a tailored GEMINI.md context file with project-specific instructions.

Tools & Extensions

Usage: /tools [desc]Sub-commands:
  • desc or descriptions - Show detailed descriptions
  • nodesc or nodescriptions - Show names only
Manage Model Context Protocol (MCP) servers.Sub-commands:
  • list or ls - List configured servers and tools
  • desc - List with descriptions
  • schema - List with descriptions and schemas
  • refresh - Restart servers and re-discover tools
  • enable / disable - Enable or disable a server
  • auth <server-name> - Authenticate with OAuth-enabled server
Sub-commands:
  • list - List active extensions
  • install - Install from git repo or local path
  • link - Link from local path
  • uninstall - Remove an extension
  • update <names>|--all - Update extensions
  • enable / disable - Toggle extension
  • config - Configure settings
  • restart - Restart all extensions
  • explore - Open extensions page in browser
Manage on-demand expertise and specialized workflows.Sub-commands:
  • list - List all discovered skills and status
  • enable <name> / disable <name> - Toggle skill
  • reload - Refresh from all tiers
Intercept and customize behavior at specific lifecycle events.Sub-commands:
  • list (or show, panel) - Display all hooks with status
  • enable <name> / disable <name> - Toggle specific hook
  • enable-all / disable-all - Toggle all hooks

Utility Commands

Manage custom slash commands from .toml files.Sub-commands:
  • reload - Reload from user/project .gemini/commands/, MCP prompts, and extensions
Replace entire chat context with a summary to save tokens while retaining high-level history.
Copies last Gemini CLI output to clipboard.Behavior:
  • Local: Uses pbcopy/xclip/clip
  • Remote (SSH/WSL): Uses OSC 52 (requires terminal support)
Requires platform clipboard tools: xclip/xsel (Linux), pbcopy (macOS), clip (Windows)
Clear visible session history and scrollback.Keyboard shortcut: Ctrl+L
Toggle the background shells view to manage long-running processes.
Sub-commands:
  • session (default) - Session duration, tool calls, performance
  • model - Token counts and quota information
  • tools - Tool-specific usage

Other Commands

  • /about - Show version info for filing issues
  • /help or /? - Display help information
  • /docs - Open documentation in browser

At Commands (@)

At commands inject file or directory content into your prompt with git-aware filtering.

Syntax

@<path_to_file_or_directory>

Examples

@path/to/your/file.txt Explain this text.

Behavior

  • Single file: Reads the file content
  • Directory: Reads content of files within directory and subdirectories
  • Git-aware filtering: Automatically excludes git-ignored files (node_modules/, dist/, .env, .git/)
    • Customize via context.fileFiltering settings
  • File types: Intended for text files; binary/large files may be skipped or truncated
  • Implementation: Uses read_many_files tool internally
Type a lone @ symbol to pass it as-is to the model (useful when discussing the @ symbol itself).

Error Handling

  • Invalid paths display an error; query may not be sent or sent without file content
  • Permission errors from read_many_files tool are reported

Shell Mode (!)

Execute system shell commands directly from Gemini CLI.

Execute Single Command

!<shell_command>
Examples:
!ls -la
!git status

Toggle Shell Mode

Type ! alone to enter/exit shell mode. When active:
  • Different coloring with “Shell Mode Indicator”
  • All input interpreted as shell commands
  • Type ! again to exit

Environment Variable

Commands executed via ! have GEMINI_CLI=1 environment variable set, allowing scripts to detect execution from within Gemini CLI.
Shell commands have the same permissions as your terminal. Use caution.

Input Shortcuts

Keyboard shortcuts for text manipulation in the input prompt:
ActionShortcut
UndoAlt+Z or Cmd+Z
RedoShift+Alt+Z or Shift+Cmd+Z
ClearCtrl+L
RewindEsc Esc (twice)

Custom Commands

Create personalized shortcuts for frequently used prompts using .toml files. See the Custom Commands documentation for details on creating and managing custom commands.

Next Steps

Configuration

Customize settings and behavior

Session Management

Resume and manage conversations

Checkpointing

Automatic snapshots before changes

Sandboxing

Isolated execution for safety

Build docs developers (and LLMs) love