Skip to main content
gradually.ai logogradually.ai
Blog
About Us
Subscribe to AI Newsletter
AI Newsletter
  1. Home
  2. AI Blog

Gemini CLI Commands: The Ultimate Menu

All Gemini CLI commands explained: Installation, authentication, MCP integration, automations and practical examples – the reference for Google's AI terminal.

FHFinn Hillebrandt
January 28, 2026
Auf Deutsch lesen
AI Programming
Gemini CLI Commands: The Ultimate Menu
𝕏XShare on XFacebookShare on FacebookLinkedInShare on LinkedInPinterestShare on PinterestThreadsShare on ThreadsFlipboardShare on Flipboard
Links marked with * are affiliate links. If a purchase is made through such links, we receive a commission.

"Free? That can't be as good as Claude Code..." That was my first thought when I heard about Gemini CLI. Google had just released their AI terminal as open source.

Spoiler: After intensive use, I have to say - for some tasks it's even better. Especially when you're working with large codebases. The 1-million-token context window is not a marketing gag, but a real game-changer. According to Google I/O 2025, over 7 million developers worldwide are already using Gemini models - a fivefold increase compared to the previous year. And with the new Gemini 3 Pro model, Google has stepped it up again.

In this article, I'll show you all Gemini CLI commands - from installation to hidden MCP integrations. This is the most complete reference you'll find. After this guide, you'll know every available command and exactly when to use Gemini CLI instead of Claude Code.

TL;DRKey Takeaways
  • Gemini CLI offers over 30 different commands for AI-powered development directly in the terminal
  • /chat, /memory, /model and /directory are the most important slash commands for daily workflow
  • Gemini 3 Pro is now available and brings improved agentic coding capabilities
  • Advanced commands enable MCP integration, session management, token counting and auto-routing between models

Installing Gemini CLI: Three paths to success

Installing Gemini CLI is refreshingly straightforward. You only need Node.js 18+ (I recommend version 20) and an internet connection:

# Method 1: Get started immediately (without installation)
npx https://github.com/google-gemini/gemini-cli

# Method 2: Install globally (my recommendation)
npm install -g @google/gemini-cli

# Method 3: Homebrew (for Mac/Linux fans)
brew install gemini-cli
Tip
Use the global installation. The npx command is convenient for the first test, but the constant downloading gets annoying with daily use.

Authentication: OAuth vs. API Key

Google offers three authentication methods. After extensive testing, I recommend OAuth - it's free and has the most generous limits:

# Option 1: Google OAuth (free, recommended)
gemini  # Opens browser for login

# Option 2: API key (for automation)
export GEMINI_API_KEY="your-key-from-aistudio.google.com"
gemini

# Option 3: Vertex AI (for enterprises)
export GOOGLE_API_KEY="enterprise-key"
export GOOGLE_GENAI_USE_VERTEXAI=true
gemini
Note
With the free OAuth login, you get 60 requests per minute and 1,000 requests per day. That's plenty for normal development work.

Basic commands: The daily workflow

Let's start with the commands I actually use every day. The Gemini CLI commands are more clearly structured than Claude Code and fit perfectly into a terminal-centric workflow.

Starting interactive mode

# Simple start in current directory
gemini

# With specific directories
gemini --include-directories ../lib,../docs

# With specific model (Flash is faster, Pro is smarter)
gemini -m gemini-2.5-flash

# With Gemini 3 Pro (if available)
gemini -m gemini-3-pro-preview

# With automatic tool approval (YOLO mode)
gemini --yolo
Warning
YOLO mode (--yolo) automatically executes all tool calls. Only use this in projects where nothing can break!

Non-interactive mode (for scripts)

For automation and CI/CD pipelines, non-interactive mode is worth its weight in gold:

# Quick question without session
gemini -p "Explain the architecture of this codebase"

# Analyze file
gemini -p "Find bugs in this file @./src/main.js"

# With Unix pipes
echo "Write a unit test for function add(a,b)" | gemini

# Analyze git diff
git diff | gemini -p "Write a commit message for these changes"

All slash commands in detail

Here's the complete list of all slash commands. I've sorted them by usage frequency - the most important ones first:

Command
Description
Example / Tip
/helpShows all available commands[object Object], or ,[object Object]
/modelSelects AI model (Auto Gemini 3, Auto Gemini 2.5, Manual)Switch between Gemini 3 Pro and Flash
/clearClears screen and context[object Object], or ,[object Object]
/memory addAdds important info to AI memory/memory add Always use TypeScript
/toolsLists available tools/tools desc
/chat saveSaves current conversation/chat save feature-implementation
/chat resumeResumes a previous conversation/chat resume feature-implementation
/chat listShows all saved conversations/chat list
/chat deleteDeletes a saved conversation/chat delete old-session
/chat shareExports conversation as Markdown/JSON/chat share file.md
/resumeSearches and resumes sessions interactivelyInteractive browser interface
/statsShows token usage and session duration/stats
/compressReplaces context with summary/compress
/mcpManages MCP servers/mcp list
/mcp authAuthenticates with MCP server/mcp auth github
/mcp descShows MCP tool descriptions/mcp desc
/mcp schemaShows JSON schema of MCP toolsUseful for MCP development
/mcp refreshReloads MCP connections/mcp refresh
/exitExits Gemini CLI cleanly[object Object], or ,[object Object]
/copyCopies last response to clipboard/copy
/memory showShows entire AI memoryCheck regularly what the AI knows
/memory refreshReloads memory from GEMINI.md/memory refresh
/memory listShows all memory file paths/memory list
/restoreRestores files before tool execution/restore [tool_call_id]
/tools descShows tool descriptions/tools descriptions
/settingsOpens settings editorActivate preview features for Gemini 3
/skillsManages agent skills (enable, disable, reload)/skills list
/themeChanges color schemeDark mode for long sessions
/vimActivates Vim mode (NORMAL/INSERT)A must for Vim enthusiasts
/privacyShows privacy info and consent optionsImportant for GDPR compliance
/bugReports bug to Google/bug "Description"
/directory addAdds additional working directories/directory add ../lib
/directory showShows all added directories/dir show
/editorSelects preferred text editor/editor
/extensionsLists active CLI extensions/extensions
/authSwitches authentication method/auth
/aboutShows version information/about
/initGenerates GEMINI.md context file/init
Tip
The /memory add command is underrated! I add project-specific rules like "Always use English comments" or "Prefer functional programming". This saves massive time.

File referencing with @ symbol

One of the most elegant features of Gemini CLI is file referencing. Instead of awkwardly copying files, you simply use the @ symbol:

# Analyze single file
"Explain this function to me @./src/utils.js"

# Include entire directory
"Refactor the API @./api/"

# Multiple files at once
"Find similarities between @./old.js and @./new.js"

# With wildcards (experimental)
"Check all tests @./tests/*.spec.js"

Shell integration: The ! operator

With the exclamation mark, you execute shell commands directly from Gemini CLI:

# Single command
!git status

# Switch to shell mode
!
# Now you're in a persistent shell
# Type 'exit' to leave

# Pipe output directly to Gemini
!npm test
"Explain these errors and suggest fixes"

CLI flags

Gemini's CLI flags are more powerful than they appear at first glance. Here are all the important options:

Flag
Description
Example
-m, --modelSelects the AI modelgemini -m gemini-3-pro-preview
-pNon-interactive mode with promptgemini -p "Analyze package.json"
-i, --prompt-interactiveStarts interactive session with promptgemini -i "Explain the architecture"
--yolo, -yAuto-approves all tool calls (deprecated, use --approval-mode=yolo)gemini --yolo
--approval-modeApproval mode for tool execution (default, auto_edit, yolo)gemini --approval-mode auto_edit
-r, --resumeResume a previous session ("latest" or index)gemini -r latest
-e, --extensionsMenu of extensions to usegemini -e ext1,ext2
-l, --list-extensionsMenu all available extensionsgemini -l
--list-sessionsMenu available sessions for current projectgemini --list-sessions
--delete-sessionDelete a session by indexgemini --delete-session 3
--allowed-toolsTools allowed without confirmationgemini --allowed-tools shell_exec,file_write
--allowed-mcp-server-namesAllowed MCP server namesgemini --allowed-mcp-server-names github,postgres
--screen-readerEnable screen reader mode for accessibilitygemini --screen-reader
--include-directoriesLoads additional directoriesgemini --include-directories ./src,./tests
--sandboxSafe execution with Docker/Podmangemini --sandbox
-d, --debugActivates debug outputgemini -d
--checkpointingSaves project snapshots before changesgemini --checkpointing
--output-format jsonStructured JSON output for scriptsgemini -p "..." --output-format json
--output-format stream-jsonReal-time streaming as JSON eventsFor real-time processing
--no-historyDisables session historygemini --no-history

Shortcuts

These shortcuts make the difference between "okay" and "really productive":

Keyboard Shortcut
Function
When to use?
Ctrl+CCancel / clear inputCancels current request
Ctrl+DExit CLIWhen input buffer is empty
Ctrl+LClear screen and redraw UIWhen terminal gets too full
Ctrl+V / Cmd+VPaste text/imageAnalyze screenshots directly
Ctrl+XOpen prompt in external editorFor long prompts
Ctrl+YToggle YOLO modeQuickly switch between modes
Ctrl+ZUndo last text editUndo for text input
Ctrl+RReverse search in historySearch previous inputs
Ctrl+TToggle TODO listTask management
Shift+TabCycle approval modesdefault, auto_edit, yolo
Esc + EscBrowse and rewind previous interactionsRewind function
TabAuto-completion / accept suggestionFor filenames after @
Ctrl+Enter / Shift+EnterInsert newline without submittingMulti-line input
Alt+MToggle Markdown renderingFormatted vs. raw output

Model selection and Gemini 3 Pro

With the /model command, you select the optimal model for your task. Google offers four tiers:

Model
Description
Usage
Auto (Gemini 3)System automatically chooses the best Gemini 3 modelDefault with preview features enabled
Auto (Gemini 2.5)System automatically chooses the best Gemini 2.5 modelDefault without preview features
ManualManually select a specific modelFull control over model choice

Activating Gemini 3 Pro: The new flagship model is available for Google AI Ultra subscribers and users with a paid API key. Here's how to activate it:

# 1. Update Gemini CLI to version 0.16+
npm update -g @google/gemini-cli

# 2. Enable preview features
/settings
# → Set "Preview features" to true

# 3. Select model
/model
# → Select "Pro" - this will use Gemini 3 Pro
Tip
Gemini 3 Pro achieves 54.2% on Terminal-Bench 2.0 and dominates the WebDev Arena Leaderboard. For complex coding tasks, it's currently the best model in Gemini CLI.

MCP

Model Context Protocol (MCP) is the reason I prefer Gemini CLI over Claude Code for certain tasks. You can integrate any services:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token"
      },
      "trust": false,
      "includeTools": ["create_repository", "search_repositories"],
      "excludeTools": ["delete_repository"]
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "postgresql://user:pass@localhost/db"
      },
      "trust": true
    }
  }
}

After configuration, you have access to extended features:

# Use GitHub integration
"Create a new repository for my React project"
# Gemini automatically uses the GitHub MCP server

# Database queries
"Show me all users who registered this week"
# Executes SQL and shows results

# Manage MCP servers
/mcp list              # Lists all servers and tools
/mcp desc              # Shows tool descriptions
/mcp schema            # JSON schema for developers
/mcp auth github       # Authenticates with MCP server
/mcp refresh           # Reloads connections
Note
MCP servers run in separate processes. If you have problems, /mcp refresh or restarting Gemini CLI helps.

Custom commands

One of my favorite features: You can create your own commands. Custom commands are defined in .toml files - either project-specific or global:

# Project-specific: .gemini/commands/test-all.toml
# Global: ~/.gemini/commands/test-all.toml

# Only "prompt" is required
prompt = """
Run the following tests sequentially and give me a summary:

1. npm test
2. npm run lint
3. npm run typecheck
4. npm run test:e2e

Show only errors and warnings, no successful tests.

Arguments: {{args}}
Git Status: !{git status}
Config file: @{package.json}
"""

# Optional fields:
# description = "Runs complete test suite"
# model = "gemini-2.5-flash"

After saving, you can simply type /test-all. For namespaced commands, use subfolders: .gemini/commands/git/commit.toml becomes /git:commit.

Tip
Custom commands also work in headless mode: gemini "/test-all" executes the command directly - perfect for CI/CD pipelines.

Token optimization

The free limits are generous, but with a few tricks you can get even more out of them:

# Compress context regularly
/compress

# Only load relevant directories
gemini --include-directories ./src --exclude node_modules,dist

# Flash model for simple tasks
gemini -m gemini-2.5-flash

# Disable history for large sessions
gemini --no-history

# Checkpoints for intermediate states
/chat save checkpoint-1
# Jump back on problems
/restore checkpoint-1

Debugging

Even Google's AI has a bad day sometimes. Here are my proven solutions for the most common problems:

Problem
Probable Cause
Solution
Authentication failsOutdated tokenClear browser cache, log in again
MCP server doesn't connectMissing dependenciesInstall npx, /mcp refresh
Token limit reachedToo much contextUse /compress or /clear
Slow responsesPro model overloadedSwitch to Flash model
Shell commands don't workSandbox mode activeStart without --sandbox
Files not foundWrong pathUse absolute paths

For stubborn problems, there are debug commands:

# Verbose mode for details
gemini -d

# System information
/stats

# MCP debug
gemini --mcp-debug

# Check tool schemas
/tools schema

# Complete reset
rm -rf ~/.gemini/cache
gemini

Frequently Asked Questions about Gemini CLI Commands

𝕏XShare on XFacebookShare on FacebookLinkedInShare on LinkedInPinterestShare on PinterestThreadsShare on ThreadsFlipboardShare on Flipboard
FH

Finn Hillebrandt

AI Expert & Blogger

Finn Hillebrandt is the founder of Gradually AI, an SEO and AI expert. He helps online entrepreneurs simplify and automate their processes and marketing with AI. Finn shares his knowledge here on the blog in 50+ articles as well as through his ChatGPT Course and the AI Business Club.

Learn more about Finn and the team, follow Finn on LinkedIn, join his Facebook group for ChatGPT, OpenAI & AI Tools or do like 17,500+ others and subscribe to his AI Newsletter with tips, news and offers about AI tools and online business. Also visit his other blog, Blogmojo, which is about WordPress, blogging and SEO.

Similar Articles

Claude Code Commands: The Ultimate Reference
AI Programming

Claude Code Commands: The Ultimate Reference

January 28, 2026
FHFinn Hillebrandt
Claude Code: The Complete Beginner's Guide
AI Programming

Claude Code: The Complete Beginner's Guide

October 15, 2025
FHFinn Hillebrandt
How to Create the Perfect AGENTS.md (incl. Template)
AI Programming

How to Create the Perfect AGENTS.md (incl. Template)

September 26, 2025
FHFinn Hillebrandt
How to Create the Perfect CLAUDE.md (incl. Template)
AI Programming

How to Create the Perfect CLAUDE.md (incl. Template)

September 25, 2025
FHFinn Hillebrandt
Claude Code vs. Gemini CLI vs. OpenAI Codex: The Ultimate Comparison
AI Programming

Claude Code vs. Gemini CLI vs. OpenAI Codex: The Ultimate Comparison

September 1, 2025
FHFinn Hillebrandt

Stay Updated with the AI Newsletter

Get the latest AI tools, tutorials, and exclusive tips delivered to your inbox weekly

Unsubscribe anytime. About 4 to 8 emails per month. Consent includes notes on revocation, service provider, and statistics according to our Privacy Policy.

gradually.ai logogradually.ai

Germany's leading platform for AI tools and knowledge for online entrepreneurs.

AI Tools

  • AI Chat
  • ChatGPT in German
  • Text Generator
  • Prompt Enhancer
  • FLUX AI Image Generator
  • AI Art Generator
  • Midjourney Prompt Generator
  • Veo 3 Prompt Generator
  • AI Humanizer
  • AI Text Detector
  • Gemini Watermark Remover
  • All Tools →

Creative Tools

  • Blog Name Generator
  • AI Book Title Generator
  • Song Lyrics Generator
  • Artist Name Generator
  • Team Name Generator
  • AI Mindmap Generator
  • Headline Generator
  • Company Name Generator
  • AI Slogan Generator

Business Tools

  • API Cost Calculator
  • Token Counter
  • AI Ad Generator
  • AI Copy Generator
  • Essay Generator
  • Story Generator
  • AI Rewrite Generator
  • Blog Post Generator
  • Meta Description Generator
  • AI Email Generator

Resources

  • MCP Server Directory
  • Agent Skills
  • n8n Hosting Comparison
  • OpenClaw Hosting Comparison

© 2025 Gradually AI. All rights reserved.

  • Blog
  • About Us
  • Legal Notice
  • Privacy Policy