Master the Gemini Command Line Interface with installation guides, usage examples, and advanced options.
Get StartedDebian, Ubuntu, Fedora
macOS 10.14+
Win10/11
Choose your platform and run the appropriate command below. The CLI will automatically verify system requirements before installation.
{`curl -fsSL https://cli.gemini.com/install.sh | sh source ~/.zshrc`}
{`iex (New-Object Net.WebClient).DownloadString('https://cli.gemini.com/install.ps1')`}
{`docker run -v $PWD:/app -w /app \ -e GEMINI_API_KEY="your_key_here" \ google/gemini-cli:latest \ gemini generate --file request.txt --outfile output.md`}
Create content from natural language prompts
{`gemini generate \\ --prompt "Explain quantum computing for high school students" \\ --file output.md`}
Generate production-ready code from text descriptions
{`gemini code \\ --prompt "Create a Flask API endpoint for user authentication" \\ --language python`}
Create and edit images using text prompts
{`gemini image \\ --prompt "Cyberpunk cityscape at night with glowing skyscrapers" \\ --output cyberpunk_city.png`}
Analyze code issues with contextual suggestions
{`gemini debug \\ --file broken_code.py \\ --output fixed_code.py`}
{`# ~/.gemini/config.yaml api_key: "YOUR_API_KEY" default_model: "gemini-pro" output_dir: ~/workspace/gemini/outputs language: en`}
Run gemini config --init
to create a new configuration file.
Use the --follow flag to maintain context between multiple CLI commands for complex workflows.
{`gemini generate --follow \\ --session myproject \\ --prompt "Create initial architecture documentation"`}
Process multiple files in one operation with pattern matching and output organization.
{`gemini code *.py \\ --output docs/ \\ --language python`}
Chain commands into complex workflows for automated documentation and code generation.
{`gemini generate \\ --prompt "Design API documentation" | gemini format \\ --style swagger`}
Analyze code for security issues, style violations, and performance optimizations.
{`gemini inspect \\ --dir ./src \\ --output issues.json`}
Master prompt engineering, batch processing, and integration with your existing development workflows.
CLI Tutorials