Note Sync Pro LogoNote Sync Pro

What is Gemini CLI?

UUtsav Khatri·June 26th, 2025
Gemini CLI is an open-source AI agent that brings Google’s Gemini large language models (LLMs) directly into your terminal or shell (cloud.google.com). It functions like a powerful coding assistant—able to read and write files, run shell commands, query the web, and reason across projects up to 1 million tokens in length (medium.com).
Key capabilities include:
Code generation & refactoring
Multimodal prompts (text + images/PDFs)
Shell automation & file manipulation
Web-grounded responses via Google Search
Extensible via Model Context Protocol (MCP) servers



📦 Installation & Setup

Prerequisites: Install Node.js v18+: node -v
Install:
One-off (no install):
npx https://github.com/google-gemini/gemini-cli
Global install (recommended):
npm install -g @google/gemini-cli
gemini
Authenticate:
Sign in with your Google account to access the free tier: Gemini 2.5 Pro (1 M token context), 60 requests/min, 1,000/day (cloud.google.com, apidog.com, medium.com, blog.google, dev.to).
OR use an API key via export GEMINI_API_KEY="YOUR_API_KEY" for higher throughput (github.com).
Launch: Run gemini in your terminal to begin.



🔧 Core Features in Action

1. Prompt & Chat Modes

Single prompt: gemini-cli prompt "Why is the sky blue?"
Interactive chat: gemini-cli chat > name 3 dog breeds > which is the heaviest?
Supports conversation memory and even loading local files via $load <path> (dev.to, github.com).



2. Shell & File Tools

Gemini CLI includes built-in tools to manipulate files, run commands, and search code:
edit, glob, grep, ls, shell, read-file, write-file, read-many-files, web-fetch, web-search (simonwillison.net).
Example: Convert all images to PNG and rename using EXIF dates:
> Convert all images in this folder to PNG and rename them by EXIF date.
Gemini CLI reasons, runs shell tools, and updates files accordingly.



3. Multimodal Projects

Gemini CLI can ingest sketches or PDFs as context—using models like Gemini Pro Vision to generate, say, a Discord bot from a PDF spec (medium.com).



4. Extensibility with MCP

MCP servers allow Gemini CLI to integrate external services, such as:
GitHub, Imagen, Veo (video), Lyria (music) (medium.com).
Setup via .gemini/settings.json and view with /mcp command (medium.com).



5. GEMINI.md Context Prompts

Project-specific guidance via GEMINI.md—e.g. enforce linting/formatting rules in Python. Gemini uses this context automatically during code generation (medium.com).



6. Flags & Automation

Run in non-interactive scripts with --prompt, enable auto-execution via --yolo, or override models with --model (medium.com).
gemini --prompt "Explain the purpose of requirements.txt"



🛠 Example Workflow: Code Refactoring + Testing

Clone a repo: git clone https://github.com/myorg/my-app.git cd my-app
Launch: gemini > Refactor service.ts to async/await and add unit tests.
Gemini CLI will:
Read and refactor the file
Write updated version
Create a corresponding test file
Optionally run npm test



💡 Why It Matters

Seamless workflow: no IDE/browser needed—everything works from your terminal (simonwillison.net, apidog.com).
Huge context: handle massive codebases thanks to 1 M token window (medium.com).
Generous free tier: 60 requests/min and 1,000/day for individual developers (blog.google).
Open & extensible: Apache‑2 licensed, community-driven, supports MCP integrations (github.com).



🎥 See It in Action

Google's Gemini CLI demo: CLI-based AI coding agent (free & open‑source)🎥



✅ Getting Started Checklist

Install Node.js 18+
Install @google/gemini-cli or use npx
Sign in via Google (or set GEMINI_API_KEY)
Start the CLI and type /tools, /mcp, --help
Drop in a GEMINI.md to customize behavior
Ask it to refactor code, automate shell tasks, or prototype apps!



✍️ Closing Thoughts

Gemini CLI is a paradigm shift: a terminal-native AI agent that reads, reasons, writes, and acts—without leaving your shell. With its massive context, open‑source ethos, and generous usage limits, it's an indispensable tool for developers, DevOps engineers, and creators alike.
Let me know if you'd like me to polish certain sections, add more use-case code samples, or tailor it to a specific audience!
0 likes

Comments

Loading comments...