Getting Started

Learn the fundamentals of Gemini CLI and start leveraging AI in your terminal workflow today.

Your First Command

After installation, try your first Gemini CLI command to verify everything is working correctly.

# Your first AI interaction
gemini "What is the weather like today?"

# Ask for coding help
gemini "Explain what this command does: ls -la"

# Get help with any topic
gemini "How do I create a React component?"

Basic Usage Patterns

Simple Questions

# Ask direct questions
gemini "What is Docker?"

# Get coding explanations
gemini "Explain async/await in JavaScript"

# Request comparisons
gemini "What's the difference between React and Vue?"

Working with Files

# Analyze a specific file
gemini "Review this code for bugs" --file app.js

# Process multiple files
gemini "Summarize these components" --file "src/components/*.tsx"

# Work with different file types
gemini "Extract key insights" --file presentation.pdf

Project-Level Analysis

# Analyze entire project structure
gemini "Describe the architecture of this application"

# Get improvement suggestions
gemini "How can I optimize this codebase for performance?"

# Security audit
gemini "Review this project for security vulnerabilities"

Essential Commands

🔧 Core Commands

gemini --helpShow all available commands and options
gemini --versionDisplay current version information
gemini auth statusCheck authentication status
gemini config listView current configuration settings

Configuration

Customize Gemini CLI to match your workflow and preferences.

Basic Configuration

# Set default model
gemini config set model gemini-2.5-pro

# Configure output format
gemini config set output-format markdown

# Set response streaming
gemini config set stream true

# Configure context window size
gemini config set max-tokens 100000

Project-Specific Settings

# Create project configuration
echo "model: gemini-2.5-pro
context-files: ['src/**/*.ts', 'docs/**/*.md']
exclude-patterns: ['node_modules', '*.log']
custom-instructions: |
  This is a TypeScript React project.
  Follow modern React patterns and hooks.
  Include comprehensive error handling." > .gemini.yml

# Use project configuration
gemini "Analyze this project following our coding standards"

Practical Examples

Code Review and Analysis

# Review a pull request
git diff main..feature-branch | gemini "Review this diff for potential issues"

# Analyze code complexity
gemini "Assess the complexity of this function and suggest simplifications" --file complex-function.js

# Security audit
gemini "Check for security vulnerabilities in this authentication code" --file auth.ts

Documentation and Learning

# Generate documentation
gemini "Create comprehensive JSDoc comments for this module" --file utils.js

# Explain complex code
gemini "Explain how this algorithm works step by step" --file sorting-algorithm.py

# Learn new concepts
gemini "Teach me about microservices architecture with practical examples"

Development Assistance

# Debug issues
gemini "Help me debug this error: TypeError cannot read property of undefined"

# Optimize performance
gemini "How can I improve the performance of this database query?" --file slow-query.sql

# Refactor code
gemini "Refactor this component to use modern React hooks" --file legacy-component.jsx

Best Practices

💡 Tips for Success

  • Be Specific: Provide clear, detailed questions for better responses
  • Use Context: Include relevant files and project information
  • Iterate: Build on previous responses for complex problems
  • Experiment: Try different approaches to find what works best
  • Stay Secure: Avoid sharing sensitive credentials or data

🚀 Next Steps

Ready to explore more? Check out the complete Commands Reference or dive into Practical Examples to see Gemini CLI in action.