Mastering Gemini CLI Commands — A Complete Beginner’s Guide
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:
➡ This creates a bug report titled “Output not showing in dark mode”.
💬 /chat
Save, list, or resume conversation checkpoints.
-
Save current chat:
-
List saved sessions:
-
Resume from a tag:
🧠 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:
-
See current memory:
-
Reload memory from GEMINI.md:
💡 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), orxclip/xsel(Linux).
🗂️ /directory or /dir
Manage directories linked to your workspace.
-
Add new directory:
-
Show added directories:
⚙️ /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:
-
Show detailed descriptions:
🖋️ /vim
If you love Vim, this one’s for you!
Toggle Vim mode:
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:
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
Gemini will read the file and give you a clear summary.
💡 Example 2: Include a folder
Gemini scans the folder (ignoring git-ignored files like node_modules/).
🔎 Quick Tips
-
Paths with spaces must be escaped:
-
Works only with text-based files (not binaries like
.jpgor.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:
Lists files in your directory — without leaving Gemini CLI.
⚙️ Example 2:
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
-
Slash (
/) → Control Gemini CLI (save chat, clear screen, manage memory, etc.) -
At (
@) → Include file or directory contents into your prompt. -
Exclamation (
!) → Run shell/system commands directly. -
Vim Mode →
/vimtoggles vim-style editing. -
Settings & Themes →
/settingsand/themepersonalize your experience. -
Chat Checkpoints →
/chat save,/chat resumelet you continue from past sessions. -
Memory →
/memory addand/memory refreshmanage AI instructions easily.
🧠 Try It Yourself
Here’s a small exercise:
-
Open Gemini CLI.
-
Type these one by one:
-
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)
How to Install :
https://www.techtreeblogs.in/blog/view_page.php?id=975efcee-5b47-4fe7-ab35-29cf209c8724
It's very useful
Leave a Comment