Gemini CLI
Gemini CLI
Google's Gemini AI in the terminal with a generous free tier - the best entry point for terminal-based AI workflows.
Key advantage: Free access to Gemini 2.5 Pro with file access, web search, and bash/Python execution.
Installation
Linux/WSL:
bashcurl -fsSL https://get.gemini.google.dev/cli | bash # Or with sudo if needed curl -fsSL https://get.gemini.google.dev/cli | sudo bash
macOS (Homebrew):
bashbrew install gemini-cli
First Launch
bash# Navigate to project directory cd ~/projects/my-project # Launch Gemini gemini
Login:
- Browser opens for Google account authentication
- Works with free Gmail accounts
- No credit card required
Free Tier
What's included:
- Model: Gemini 2.5 Pro (latest)
- Context window: 200,000 tokens
- Rate limits: Generous for personal use
- Tools: File access, web search, bash/Python execution
No payment needed - standard Google account is sufficient.
Core Features
File Access
Gemini can read and write files:
markdownResearch the top 10 coffee brewing methods from reputable sources and compile results into best-coffee-method.md
Gemini will:
- Search the web
- Compile findings
- Ask permission to create file
- Write to your project directory
No copy/paste needed - files appear directly in your filesystem.
Available Tools
View enabled tools:
bash# Inside Gemini session /tools
Default tools:
execute_code- Run bash/Python scriptsgoogle_search- Web searchcode_execution- Multi-language code executionfile_access- Read/write project files
Add custom tools via configuration (advanced).
Web Search Integration
markdownFind the latest benchmarks for AMD Ryzen 9000 series CPUs and summarize key performance improvements
Gemini automatically:
- Searches Google
- Filters reputable sources
- Synthesizes findings
- Cites sources
Context Window Visibility
Unlike browser interface, terminal shows context usage:
99% context left
Monitor context consumption:
- Every question reduces available context
- Visible percentage helps you manage conversation length
- Browser version hides this information
When context fills up:
- Start new session
- Use context file (gemini.md) to maintain continuity
- AI loads context from file automatically
Context File Workflow
Initialize project context:
bash# Inside Gemini session /init
This creates gemini.md:
- Analyzes project directory
- Describes purpose based on files
- Tracks decisions and progress
- Auto-loaded on future sessions
Example gemini.md:
markdown# Coffee Project ## Purpose Research and blog series about coffee brewing methods. ## Current Status - Completed: Initial research (10 methods documented) - In Progress: Blog post #1 (intro to pour-over) - Next: Record video demonstrations ## Key Decisions - Focus on beginner-friendly methods first - Include cost breakdowns for each method - Video series to complement written posts ## Files - best-coffee-method.md - Research compilation - coffee-blog-plan.md - Series outline
New session in same directory:
bashgemini # Automatically loads gemini.md # Full context restored
Update context:
markdownUpdate gemini.md to reflect that we finished blog post #1
Headless Mode
Run Gemini without TUI:
bashgemini -p "your prompt here"
Use cases:
- Quick one-off queries
- Scripting/automation
- Called by other AI agents
Example:
bashgemini -p "Find the top 5 NAS systems under $500"
Output printed directly to stdout.
Multi-AI Workflow
Gemini works alongside Claude and Codex:
Same directory approach:
bash# Terminal 1 gemini # Terminal 2 claude # Terminal 3 codex
Shared context via .md files:
gemini.md- Gemini's contextclaude.md- Claude's contextagents.md- Codex's context
Keep synced:
markdown# In Claude Update gemini.md and claude.md to reflect research completion
Division of labor:
- Gemini: Web research (free tier advantage)
- Claude: Complex writing and analysis
- ChatGPT: High-level review
All working on same project files simultaneously.
Commands
| Command | Action |
|---|---|
/init | Create gemini.md context file |
/tools | Show available tools |
/help | Show all commands |
Ctrl-C | Interrupt response |
Example Workflows
Research + Documentation
markdownResearch the top 10 JavaScript testing frameworks. For each, note: - Popularity (npm downloads) - Key features - Best use cases Save results to testing-frameworks.md
Gemini:
- Searches web
- Gathers data
- Asks permission to create file
- Writes structured markdown
Code Execution
markdownWrite a Python script that analyzes my /logs/ directory and creates a summary of error frequencies. Run the script and save output to error-summary.txt
Gemini:
- Reads files in /logs/
- Writes Python script
- Executes script
- Saves output
Iterative Development
bash# Session 1 gemini > Create a bash script to organize my downloads folder # Session 2 (next day) gemini # Loads gemini.md automatically > Update the script to also move images to Photos/
Context persists via gemini.md file.
Comparison: Gemini CLI vs Browser
| Feature | Terminal | Browser |
|---|---|---|
| Context visibility | Percentage shown | Hidden |
| File access | Direct filesystem | Copy/paste only |
| Persistence | gemini.md files | Stuck in chat |
| Multi-tool | Works with Claude/Codex | Siloed |
| Scripting | Headless mode | Not available |
| Model | Gemini 2.5 Pro | Same |
| Free tier | Yes | Yes |
Tips
Leverage free tier:
- Use Gemini for research tasks
- Offload web searches from paid Claude sessions
- Headless mode for automation
Context management:
- Initialize gemini.md early
- Update context at end of sessions
- Start new session when context fills
Multi-AI optimization:
- Gemini for research (free)
- Claude for complex writing (paid)
- ChatGPT for review (paid)
- All work in same directory
File permissions:
- Gemini asks before creating files (security)
- Approve file operations you trust
- Review files after AI writes them
Common Use Cases
Web research:
markdownFind the latest research on lithium battery recycling and summarize environmental impact
Data analysis:
markdownRead sales-data.csv and create a summary with: - Total revenue - Top 5 products - Month-over-month growth
Documentation:
markdownRead all .js files in /src/ and create API documentation in api-docs.md
Code debugging:
markdownReview error-log.txt and suggest likely causes for the timeout errors
Links
Gemini CLI Documentation
- URL: https://get.gemini.google.dev/
- Summary: Official installation and usage guide for Gemini CLI
- Related: Claude Code with Agents, OpenCode
NetworkChuck Video: You've Been Using AI the Hard Way
- URL: https://www.youtube.com/watch?v=MsQACpcuTkU
- Summary: Comprehensive guide featuring Gemini CLI alongside Claude Code and OpenCode
- Related: Claude Code with Agents, Context Files for AI Projects