Linux command
gemini 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start an interactive session
gemini
Run a prompt non-interactively
gemini -p "[explain this code]"
Use a specific model
gemini -m [gemini-2.5-flash]
Start interactive session
gemini -i "[explain this code]"
Get JSON output for scripting
gemini -p "[prompt]" --output-format json
Run with sandbox mode enabled
gemini --sandbox
Include a file in the conversation
gemini``` then ```@[path/to/file.py] [explain this code]
说明
Gemini CLI is Google's open-source AI agent that brings the power of Gemini directly into your terminal. It enables developers to write, refactor, and debug code, execute commands, and analyze entire repositories using natural language. The CLI uses a reason and act (ReAct) loop with built-in tools including Google Search grounding, file operations, shell commands, and web fetching. It supports MCP (Model Context Protocol) for custom integrations and can be configured with project-specific instructions via GEMINI.md files. Free tier users get 60 requests per minute and 1,000 requests per day with a personal Google account, accessing models with a 1 million token context window. The tool works across macOS, Linux, and Windows.
参数
- -p, --prompt _PROMPT_
- Run in headless (non-interactive) mode with the given prompt.
- -i, --prompt-interactive _PROMPT_
- Start interactive session with the provided prompt as initial input.
- -m, --model _MODEL_
- Specify model variant (e.g., gemini-2.5-pro, gemini-2.5-flash).
- --output-format _FORMAT_
- Output format: text, json, or stream-json.
- --sandbox, -s
- Run in sandboxed Docker environment for safety.
- --yolo
- Auto-approve all tool actions without confirmation.
- --debug
- Enable debug mode with verbose output.
- --help
- Display help information.
- --version
- Show version number.
FAQ
What is the gemini command used for?
Gemini CLI is Google's open-source AI agent that brings the power of Gemini directly into your terminal. It enables developers to write, refactor, and debug code, execute commands, and analyze entire repositories using natural language. The CLI uses a reason and act (ReAct) loop with built-in tools including Google Search grounding, file operations, shell commands, and web fetching. It supports MCP (Model Context Protocol) for custom integrations and can be configured with project-specific instructions via GEMINI.md files. Free tier users get 60 requests per minute and 1,000 requests per day with a personal Google account, accessing models with a 1 million token context window. The tool works across macOS, Linux, and Windows.
How do I run a basic gemini example?
Run `gemini` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -p, --prompt _PROMPT_ do in gemini?
Run in headless (non-interactive) mode with the given prompt.