TechTree

 Mastering Gemini CLI Commands — A Complete Beginner’s Guide

By Harshit • Nov 10, 2025

If you’ve just started exploring the Gemini CLI, you might have noticed it feels more like chatting with a smart AI assistant right from your terminal. But there’s a lot more power hidden inside — especially through its CLI commands.

This guide will help you understand all the built-in commands (like /, @, and ! commands), what they do, and how you can use them with examples — even if you’ve never used a CLI before.


🧭 What Are Gemini CLI Commands?

Gemini CLI has special commands that let you:

  • Control your session

  • Manage memory and files

  • Interact with local directories

  • Run shell commands

  • And even talk to external tools

These commands make Gemini more than just an AI chat — it becomes your coding partner, file explorer, and terminal assistant.

There are 3 types of commands:

Type Symbol Used For
Slash Commands / Control Gemini CLI features
At Commands @ Include file or directory content
Shell Commands ! Run terminal or system commands

Let’s explore each of them step by step 👇


⚡ Slash Commands (/)

Slash commands give you meta control over Gemini CLI — they don’t go to the AI model, they control the environment.

Here are the most useful ones:

🐞 /bug

Purpose: File an issue about Gemini CLI directly to GitHub.

Example:

 
/bug Output not showing in dark mode

➡ This creates a bug report titled “Output not showing in dark mode”.


💬 /chat

Save, list, or resume conversation checkpoints.

  • Save current chat:

     
    /chat save mysession
  • List saved sessions:

     
    /chat list
  • Resume from a tag:

     
    /chat resume mysession

🧠 Tip: Checkpoints are saved in:

  • Linux/macOS → ~/.gemini/tmp/<project_hash>/

  • Windows → C:\Users\<YourUsername>\.gemini\tmp\<project_hash>\


🧹 /clear

Clears your screen instantly.

Shortcut: Ctrl + L
Perfect when your terminal feels cluttered.


🧠 /memory

Lets you view or modify what Gemini “remembers” in your project.

  • Add something to memory:

     
    /memory add Always summarize my answers in points
  • See current memory:

     
    /memory show
  • Reload memory from GEMINI.md:

     
    /memory refresh

💡 This is especially useful if your project uses custom instructions in GEMINI.md.


🪄 /compress

Summarizes your chat so far into a short context — keeps things light and saves tokens.


📋 /copy

Copies the last AI response to your clipboard.

Works with pbcopy (macOS), clip (Windows), or xclip/xsel (Linux).


🗂️ /directory or /dir

Manage directories linked to your workspace.

  • Add new directory:

     
    /directory add ./src, ./tests
  • Show added directories:

     
    /directory show

⚙️ /settings

Opens a settings editor inside CLI.

You can change:

  • Themes

  • Authentication

  • Performance settings
    without manually editing ~/.gemini/settings.json.


💡 /model

Choose which Gemini model to use interactively.


🔐 /auth

Change your authentication method — e.g., switch from API key to OAuth.


🎨 /theme

Change the CLI’s color theme right inside the terminal.


🧩 /tools

Shows all available tools Gemini CLI can access.

  • Just list tools:

     
    /tools
  • Show detailed descriptions:

     
    /tools desc

🖋️ /vim

If you love Vim, this one’s for you!

Toggle Vim mode:

 
/vim

You’ll get normal and insert modes with full navigation like h, j, k, l, and editing shortcuts like dd, cw, etc.


🔄 /restore

Undo file edits made by Gemini tools.

Example:

 
/restore

Lists checkpoints to restore from.


💬 /help

Shows help for all available commands.


🔚 /quit or /exit

Exit Gemini CLI safely.


📎 At Commands (@)

At commands are used to inject file or folder content into your query.

Think of it as saying:

“Hey Gemini, look at this file and explain it!”

💡 Example 1: Include a file

 
@README.md Summarize this file.

Gemini will read the file and give you a clear summary.

💡 Example 2: Include a folder

 
@src/my_project/ Explain the purpose of this codebase.

Gemini scans the folder (ignoring git-ignored files like node_modules/).


🔎 Quick Tips

  • Paths with spaces must be escaped:

     
    @My\ Documents/notes.txt
  • Works only with text-based files (not binaries like .jpg or .exe).

  • You’ll see a “read_many_files” message confirming what files were processed.


🧨 Shell Commands (!)

This is where Gemini CLI becomes truly powerful.

Anything starting with ! is a shell command, executed directly on your system.

⚙️ Example 1:

 
!ls -la

Lists files in your directory — without leaving Gemini CLI.

⚙️ Example 2:

 
!git status

Runs Git commands inside Gemini.


🔁 Toggle Shell Mode

Typing just ! puts you into shell mode.

Now every line you type acts as a terminal command.

Exit shell mode by typing exit or pressing Ctrl+C.


⚠️ Caution

Commands in shell mode have full system access — they’re as powerful as your terminal commands.


⌨️ Input Shortcuts

Action Shortcut
Undo last input Ctrl + Z
Redo undone input Ctrl + Shift + Z
Clear screen Ctrl + L

🧾 Summary — Remember These Key Points

  1. Slash (/) → Control Gemini CLI (save chat, clear screen, manage memory, etc.)

  2. At (@) → Include file or directory contents into your prompt.

  3. Exclamation (!) → Run shell/system commands directly.

  4. Vim Mode/vim toggles vim-style editing.

  5. Settings & Themes/settings and /theme personalize your experience.

  6. Chat Checkpoints/chat save, /chat resume let you continue from past sessions.

  7. Memory/memory add and /memory refresh manage AI instructions easily.


🧠 Try It Yourself

Here’s a small exercise:

  1. Open Gemini CLI.

  2. Type these one by one:

     
      1. /clear 
      2. /theme
      3. /model
      4. /chat
      5. save first-session
      6. @README.md Summarize this file.
      7. !ls
  3. Observe how each command behaves!

You’ll get a hands-on feel for how powerful — yet simple — Gemini CLI really is.


🎯 Final Thoughts

Gemini CLI is not just an AI chat — it’s your interactive AI workspace.
With /, @, and ! commands, you can blend AI conversations, project context, and system commands all in one smooth workflow.

It’s the future of command-line productivity — simple, smart, and super powerful.

Comments (2)

Brajesh Jha

It's very useful

Leave a Comment