Gemini CLI
Within Gemini CLI, packages/cli
is the frontend for users to send and receive prompts with the Gemini AI model and its associated tools. For a general overview of Gemini CLI, see the main documentation page.
Basic features
Section titled “Basic features”- Commands: A reference for all built-in slash commands (e.g.,
/help
,/chat
,/tools
). - Custom Commands: Create your own commands and shortcuts for frequently used prompts.
- Headless Mode: Use Gemini CLI programmatically for scripting and automation.
- Themes: Customizing the CLI’s appearance with different themes.
- Keyboard Shortcuts: A reference for all keyboard shortcuts to improve your workflow.
- Tutorials: Step-by-step guides for common tasks.
Advanced features
Section titled “Advanced features”- Checkpointing: Automatically save and restore snapshots of your session and files.
- Enterprise Configuration: Deploying and manage Gemini CLI in an enterprise environment.
- Sandboxing: Isolate tool execution in a secure, containerized environment.
- Telemetry: Configure observability to monitor usage and performance.
- Token Caching: Optimize API costs by caching tokens.
- Trusted Folders: A security feature to control which projects can use the full capabilities of the CLI.
- Ignoring Files (.geminiignore): Exclude specific files and directories from being accessed by tools.
- Context Files (GEMINI.md): Provide persistent, hierarchical context to the model.
Non-interactive mode
Section titled “Non-interactive mode”Gemini CLI can be run in a non-interactive mode, which is useful for scripting and automation. In this mode, you pipe input to the CLI, it executes the command, and then it exits.
The following example pipes a command to Gemini CLI from your terminal:
echo "What is fine tuning?" | gemini
You can also use the --prompt
or -p
flag:
gemini -p "What is fine tuning?"
For comprehensive documentation on headless usage, scripting, automation, and advanced examples, see the Headless Mode guide.