Mastering Gemini CLI Slash (/), At (@), & Shell (!) Commands
Gemini CLI features an intuitive command syntax designed to streamline interactive terminal workflows. By mastering Slash (/) commands, At (@) path annotations, and Exclamation (!) shell execution, developers can rapidly control tool behavior, ingest project files, manage session history, and run terminal commands directly within the agent prompt.
This guide serves as an authoritative cheatsheet and practical reference for all interactive commands available in Gemini CLI.
Slash (/) Commands: Session & Tool Controls
Slash commands begin with / and allow developers to configure agent behavior, manage active tools, toggle UI modes, and handle conversation history.
Using slash commands overrides normal prompt evaluation, executing system-level actions instantly without consuming model token generation time.
Quick reference
- Use
/toolsto inspect connected Model Context Protocol (MCP) servers and toggled system utilities. - Use
/chat save <name>to preserve intermediate investigation state before attempting risky code changes. - Toggle
/vimmode for modal keybindings if you prefer keyboard-centric terminal navigation.
Remember this
Slash commands provide instant system control over tool states, UI modes, and saved session checkpoints.
At (@) Path Annotations: Context Ingestion
The At (@) annotation allows you to dynamically inject specific files, entire directories, or external MCP tools directly into your prompt context.
When you type @src/services/auth.ts, Gemini CLI reads the file contents and prepends it to the prompt payload, ensuring the model has exact source code context.
Quick reference
- Inject single files:
@src/index.ts Explain the entry point logic. - Inject directories:
@src/components/ Summarize our UI component structure. - Inject MCP tools:
@postgres-mcp Execute a SELECT query on active subscriptions.
Remember this
Using @path annotations guarantees that the model inspects exact, up-to-date repository code without manual copy-pasting.
Exclamation (!) Commands: Direct Shell Execution
Prefixing a prompt line with an exclamation mark (!) executes the command directly in your local terminal shell without passing it through model processing.
This provides a seamless bridge between natural language AI prompts and direct bash/zsh execution within the same interactive session. For related workflows, see our Gemini CLI Getting Started Guide and Context Window Management.
Quick reference
- Run direct shell commands:
!git statusor!npm test. - Inspect system processes:
!ps aux | grep node. - Combine shell commands with AI analysis:
!git diff | gemini Explain these changes.
Remember this
Exclamation mark commands let you execute raw bash operations instantly alongside conversational AI prompts.
Key takeaway
Mastering /, @, and ! syntax turns Gemini CLI into a fluid extension of your command-line workflow, allowing you to control tools, inject files, and execute shell commands at full speed.
Related Articles
Explore this topic