Skip to Content

How to Use Gemini CLI AI Agent on Your Terminal?

Is Gemini CLI the Smartest AI Tool for Developers? Discover Its Impressive Features

Gemini CLI is a free tool that brings Google's Gemini AI right into your terminal. It’s designed to help you get things done fast and simply, making your work smoother and more enjoyable.

What Is Gemini CLI?

Gemini CLI is an open-source program. It lets you use Gemini AI models from your command line. You can ask it to write code, fix errors, organize files, or even create documents. No need to leave your terminal window.

  • Built on Gemini 2.5 Pro, which can handle a lot of information at once.
  • Uses a smart loop called Reason and Act (ReAct) to not only answer your questions but also do things like edit files or run commands (with your okay).
  • You can see and change the code since it’s open-source.
  • Free to use for most people: up to 60 requests per minute and 1,000 per day with a Google account.
  • Paid plans are available for bigger needs.

Key Features

  • Suggests commands and writes new code using AI.
  • Creates shell scripts, browses folders, and understands your project’s setup.
  • Supports plugins for tools like Docker, Git, Node.js, and Python.
  • Handles text, images, and code snippets as input.
  • Works on Windows, macOS, and Linux.
  • Integrates with your file manager for easy file changes.
  • Runs in a secure sandbox—it only sees files you allow, keeping your data safe.

How to Set Up Gemini CLI

You can use Gemini CLI on Linux, macOS, or Windows. It’s easy to get started.

Step 1: Install Node.js and npm

You need Node.js and npm first. Download them from the official Node.js website.

For Linux:

Install Fast Node Manager (fnm):

curl -o- https://fnm.vercel.app/install | bash

Use fnm to install Node.js:

fnm install 22

Check your versions:

node -v
npm -v

Step 2: Install Gemini CLI

Install Gemini CLI globally:

npm install -g @google/generative-ai

The -g flag makes the command available everywhere in your terminal.

Step 3: Launch and Authenticate

Start Gemini CLI:

gemini
  1. Pick your favorite theme.
  2. Choose how to log in. Use your Google account for free access.
  3. A browser window will open. Log in and give permission.
  4. After that, you’re ready to use Gemini CLI.

Step 4: Explore Help

See all commands and options:

gemini --help

Practical Ways to Use Gemini CLI

Gemini CLI fits right into your daily work. Here are some easy examples:

Generate code and save it

Tell Gemini CLI what you need, and it will write and save the code for you.

Explain code you don’t understand

gemini > Explain this Python code to me "path/to/your/file.py"

You’ll get a simple explanation.

Rename image files by date

gemini > Rename all JPEG files in this directory to include their creation date

It scans, reads the dates, and renames your files automatically.

Debug errors

Paste an error message or screenshot and ask for help.

gemini > I'm getting the following error in my JavaScript code: 'TypeError: Cannot read properties of undefined (reading 'map')'. What could be the cause and how can I fix it?

Gemini CLI will suggest reasons and fixes.

Help with Git

It can write commit messages, summarize changes, or describe pull requests.

Create scripts and documents

Ask for Bash scripts, organize files, or generate documents.

Security and Privacy

Gemini CLI works in a sandbox. It only sees files and folders you choose. You control what it can access, keeping your private data safe.

Gemini CLI is a helpful, free tool that brings smart AI to your terminal. It saves time, makes tasks simpler, and helps you work better. Try it today and see how much easier your workflow can become.