Home OpenAI Getting started with Gemini Command Line Interface (CLI)
OpenAI

Getting started with Gemini Command Line Interface (CLI)

Share
Getting started with Gemini Command Line Interface (CLI)
Share


Google recently released the Gemini CLI, a powerful command-line tool designed to supercharge developer workflows with AI. Whether you’re working across massive codebases, automating tedious tasks, or generating new apps from sketches and PDFs, Gemini CLI brings multimodal intelligence right to your terminal.

With Gemini CLI, you can:

  • Query and edit large codebases—even beyond the standard 1M token context window.
  • Generate apps from visual inputs like PDFs or design sketches.
  • Automate operational workflows—from handling pull requests to managing rebases.
  • Connect external tools and MCP servers, including Imagen, Veo, and Lyria for media generation.
  • Use Google Search as a grounding tool, directly within your terminal.

In this tutorial, we’ll walk you through how to install, configure, and start using Gemini CLI to enhance your daily developer tasks.

Installing Node JS

To get started, you’ll need to have Node.js installed on your system:

  • Go to nodejs.org and download the latest LTS version.
  • Run the installer.
  • Use the default settings and complete the installation.

Installing & using the CLI

To install the Gemini CLI, run the following command:

npm install -g @google/gemini-cli

Once installed, it can be initialized by simple running the following code in the terminal

On the first run, you’ll be prompted to:

  • Choose a color theme for the CLI interface.
  • Authenticate with your personal Google account – This allows access to Gemini with generous usage limits:  60 requests per minute and 1,000 requests per day.

You’re now ready to start using Gemini CLI to enhance your development workflow!

If you need access to a specific Gemini model or want higher usage limits, you can use your own API key.

  • Generate a key from Google AI Studio.
  • Set it as an environment variable in your terminal by running:
export GEMINI_API_KEY="YOUR_API_KEY"

Replace YOUR_API_KEY with the actual key you generated. This allows Gemini CLI to authenticate using your key instead of your personal Google account.

Querying a GitHub Repo with Gemini

Once everything is configured, we will test it with a Github repo

Run the following command to clone the Marktechpost Github repo containing multiple AI tutorials

git clone https://github.com/Marktechpost/AI-Notebooks.git
cd AI-Notebooks

Once in the AI-Notebooks folder, run the following command to run the CLI

This will launch the CLI

Summarizing the different tutorials in the repository

To get started, let’s try a simple prompt:

Give an overview of the different tutorials in this repository

Gemini CLI will read the README.md file—assuming it contains details about the tutorials—and generate a concise summary based on that information.

Explaining the different files in a sub-folder

To refer to a specific directory or file in your prompt, use the @ symbol followed by the folder or file name. Gemini CLI also supports auto-complete, so when you type @, it will suggest available files and folders automatically.

Let’s test this with the following prompt:

@A2A_Simple_Agent briefly explain the different files in this folder and how they work together to implement the A2A agent. Focus only on the .py files and the README.md file

Executing a git command

Gemini CLI can also execute shell commands directly from your prompts.

How many git commits have been made so far

When running a command like this, Gemini will:

  • Ask for your permission before executing it.
  • Run the shell command safely.
  • Automatically fetch and display the result.

Updating the memory

We can also manage the AI’s instructional context using the /memory command

/memory add This Git repository contains multiple self-contained tutorial projects demonstrating how to use the Gemini CLI and build agent-based systems. Each folder (e.g., A2A_Simple_Agent) focuses on a specific concept like agent communication, tool use, or integration patterns. When asked, summarize or build on individual tutorials while keeping their scope isolated.

Checking the stats

The /stats command in Gemini CLI provides a detailed summary of your current session. It shows key metrics such as total token usage, any savings from cached tokens (when available), and the overall session duration. This is useful for tracking your usage efficiency and understanding how the model is being utilized during your workflow.

Quitting the session

You can end your Gemini CLI session at any time by using the /quit command. Once you exit, the CLI will display a session summary—including total tokens used, session duration, and a breakdown of input and output tokens.

Further reading

To explore the full range of commands, check out the Gemini CLI Commands Guide. There are many powerful commands that make Gemini CLI a versatile tool for developers. In this tutorial, we’ve only scratched the surface to give you a basic overview of its core features. For more details and updates, visit the official Gemini CLI GitHub repository.


I am a Civil Engineering Graduate (2022) from Jamia Millia Islamia, New Delhi, and I have a keen interest in Data Science, especially Neural Networks and their application in various areas.



Source link

Share

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Articles
Tencent Open Sources Hunyuan-A13B: A 13B Active Parameter MoE Model with Dual-Mode Reasoning and 256K Context
OpenAI

Tencent Open Sources Hunyuan-A13B: A 13B Active Parameter MoE Model with Dual-Mode Reasoning and 256K Context

Tencent’s Hunyuan team has introduced Hunyuan-A13B, a new open-source large language model...

Alibaba Qwen Team Releases Qwen-VLo: A Unified Multimodal Understanding and Generation Model
OpenAI

Alibaba Qwen Team Releases Qwen-VLo: A Unified Multimodal Understanding and Generation Model

The Alibaba Qwen team has introduced Qwen-VLo, a new addition to its...

Getting Started with MLFlow for LLM Evaluation
OpenAI

Getting Started with MLFlow for LLM Evaluation

MLflow is a powerful open-source platform for managing the machine learning lifecycle....

Unbabel Introduces TOWER+: A Unified Framework for High-Fidelity Translation and Instruction-Following in Multilingual LLMs
OpenAI

Unbabel Introduces TOWER+: A Unified Framework for High-Fidelity Translation and Instruction-Following in Multilingual LLMs

Large language models have driven progress in machine translation, leveraging massive training...