Getting began with Gemini Command Line Interface (CLI)


Google lately launched the Gemini CLI, a strong command-line instrument designed to supercharge developer workflows with AI. Whether or not you’re working throughout huge codebases, automating tedious duties, or producing new apps from sketches and PDFs, Gemini CLI brings multimodal intelligence proper to your terminal.

With Gemini CLI, you possibly can:

  • Question and edit giant codebases—even past the usual 1M token context window.
  • Generate apps from visible inputs like PDFs or design sketches.
  • Automate operational workflows—from dealing with pull requests to managing rebases.
  • Join exterior instruments and MCP servers, together with Imagen, Veo, and Lyria for media technology.
  • Use Google Search as a grounding instrument, straight inside your terminal.

On this tutorial, we’ll stroll you thru the right way to set up, configure, and begin utilizing Gemini CLI to reinforce your every day developer duties.

Putting in Node JS

To get began, you’ll must have Node.js put in in your system:

  • Go to nodejs.org and obtain the most recent LTS model.
  • Run the installer.
  • Use the default settings and full the set up.

Putting in & utilizing the CLI

To put in the Gemini CLI, run the next command:

npm set up -g @google/gemini-cli

As soon as put in, it may be initialized by easy operating the next code within the terminal

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

  • Select a colour theme for the CLI interface.
  • Authenticate together with your private Google account – This permits entry to Gemini with beneficiant utilization limits:  60 requests per minute and 1,000 requests per day.

You’re now prepared to start out utilizing Gemini CLI to reinforce your improvement workflow!

In the event you want entry to a selected Gemini mannequin or need greater utilization limits, you need to use your individual API key.

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

Exchange YOUR_API_KEY with the precise key you generated. This permits Gemini CLI to authenticate utilizing your key as an alternative of your private Google account.

Querying a GitHub Repo with Gemini

As soon as all the things is configured, we’ll check it with a Github repo

Run the next command to clone the Marktechpost Github repo containing a number of AI tutorials

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

As soon as within the AI-Notebooks folder, run the next command to run the CLI

This can launch the CLI

Summarizing the totally different tutorials within the repository

To get began, let’s strive a easy immediate:

Give an summary of the totally different tutorials on this repository

Gemini CLI will learn the README.md file—assuming it comprises particulars in regards to the tutorials—and generate a concise abstract based mostly on that data.

Explaining the totally different information in a sub-folder

To discuss with a selected listing or file in your immediate, use the @ image adopted by the folder or file identify. Gemini CLI additionally helps auto-complete, so while you kind @, it would counsel obtainable information and folders routinely.

Let’s check this with the next immediate:

@A2A_Simple_Agent briefly clarify the totally different information on this folder and the way they work collectively to implement the A2A agent. Focus solely on the .py information and the README.md file

Executing a git command

Gemini CLI also can execute shell instructions straight out of your prompts.

What number of git commits have been made to date

When operating a command like this, Gemini will:

  • Ask on your permission earlier than executing it.
  • Run the shell command safely.
  • Robotically fetch and show the consequence.

Updating the reminiscence

We are able to additionally handle the AI’s tutorial context utilizing the /reminiscence command

/reminiscence add This Git repository comprises a number of self-contained tutorial tasks demonstrating the right way to use the Gemini CLI and construct agent-based programs. Every folder (e.g., A2A_Simple_Agent) focuses on a selected idea like agent communication, instrument use, or integration patterns. When requested, summarize or construct on particular person tutorials whereas maintaining their scope remoted.

Checking the stats

The /stats command in Gemini CLI offers an in depth abstract of your present session. It reveals key metrics similar to whole token utilization, any financial savings from cached tokens (when obtainable), and the general session length. That is helpful for monitoring your utilization effectivity and understanding how the mannequin is being utilized throughout your workflow.

Quitting the session

You possibly can finish your Gemini CLI session at any time by utilizing the /stop command. When you exit, the CLI will show a session abstract—together with whole tokens used, session length, and a breakdown of enter and output tokens.

Additional studying

To discover the total vary of instructions, try the Gemini CLI Commands Guide. There are lots of highly effective instructions that make Gemini CLI a flexible instrument for builders. On this tutorial, we’ve solely scratched the floor to present you a fundamental overview of its core options. For extra particulars and updates, go to the official Gemini CLI GitHub repository.


I’m a Civil Engineering Graduate (2022) from Jamia Millia Islamia, New Delhi, and I’ve a eager curiosity in Knowledge Science, particularly Neural Networks and their software in varied areas.

Leave a Reply

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