Mastering the Command Line with gemini-cli

Mastering the Command Line with gemini-cli
Photo by Steve Johnson / Unsplash

The gemini-cli is a powerful tool that brings the capabilities of Google's Gemini models directly to your terminal. Whether you're looking to quickly summarize a document, generate code snippets, or just brainstorm ideas, gemini-cli offers a seamless and efficient way to interact with large language models without leaving your command line environment.

Getting Started

Using gemini-cli is as simple as typing your query:

gemini-cli "Explain the concept of a closure in JavaScript."

The CLI will process your request and stream the response back to your terminal.

Power Tip: Changing the Gemini Model

By default, gemini-cli uses a sensible default model (often a fast and capable one like gemini-2.5-flash). However, for tasks that require more complex reasoning, a larger context window, or a different performance profile, you might want to switch to a different model, such as gemini-2.5-pro.

You can easily control which model the CLI uses by setting the GEMINI_MODEL environment variable.

Here's how you can temporarily switch to the Pro model for a single command:

GEMINI_MODEL=gemini-2.5-pro gemini-cli "Write a detailed technical specification for a new microservice."

Or, to set it for your entire shell session:

export GEMINI_MODEL=gemini-2.5-pro
gemini-cli "What model am I currently using?"

Remember to check the official Gemini API documentation for the latest list of available models and their specific capabilities. Happy prompting!