close
Sitemap
Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Gemini CLI Tutorial Series

13 min readJun 27, 2025

--

Welcome to the Gemini CLI Tutorial Series. It is an open-source AI agent that brings the power of Gemini directly into your terminal. You can use it for both coding related tasks as well as other tasks, it comes integrated with various tools, plus support for MCP servers and most importantly, its open source and comes with a generous free tier (60 requests/min and 1,000 requests/day with personal Google account). Here are some reasons on why Gemini CLI?

You can read about the announcement blog post and bookmark the Github page for the project, that contains the latest documentation.

  1. Announcement blog post
  2. Github Project

You would have definitely come to this series after reading/hearing about it and hence we will dive straight into putting it to work.

Let’s go.

Gemini CLI Tutorial Series:

Part 1 : Installation and Getting Started (this post)
Part 2 : Gemini CLI Command line options
Part 3 : Configuration settings via settings.json and .env files
Part 4 : Built-in Tools
Part 5: Using Github MCP Server
Part 6: More MCP Servers : Firebase, Google Workspace, Google Gen AI Media Services and MCP Toolbox for Databases
Part 7: Custom slash commands
Part 8: Building your own MCP Server
Part 9: Understanding Context, Memory and Conversational Branching
Part 10: Gemini CLI and VS Code Integration
Part 11: Gemini CLI Extensions
Part 12: Gemini CLI GitHub Actions
Part 13 : Gemini CLI Observability
Part 14: Gemini CLI extensions for Google Data Cloud
Part 15: Gemini CLI extensions for Google Workspace

➡️ Codelab : Hands-on Gemini CLI

Blog post updates:

January 7, 2026
- Screenshots updated for Gemini CLI version 0.22.x at the time of writing
- Validated content and output based on the commands used, reduced text for better readability
- Added settings configuration to allow for Preview features in Gemini CLI

September 10, 2025
-
Screenshots as of Gemini CLI version 0.4.0. Prerequisite for Node version bumped to 20+.
- Validated content and output based on the commands used in the article
- Clearer and added explanations in a few places.

Installation and Getting Started

In the first part of the tutorial series, we will look at setting up our machine for Gemini CLI. Additionally, we will look at getting started with a basic prompt or two and see how it all works. We will dive deeper into configuration, context and lot more settings for this tool, but in this part, we will keep things light and just go through a few initial steps.

Press enter or click to view image in full size
Image
Reference : https://github.com/google-gemini/gemini-cli/blob/main/docs/assets/gemini-screenshot.png

Cloud Shell comes with Gemini CLI

If you are not looking to install this, consider using Gemini CLI from Cloud Shell. Cloud Shell comes preinstalled with Gemini CLI. You will need to have a Google Cloud Project with billing enabled and know how to navigate your way through Google Cloud console and can launch the Cloud Shell.

If you prefer this method, simply skip the next section i.e. Installation and setup.

Installation and setup

The steps to install Gemini CLI are straightforward. You require Node.js version 20 or higher installed on your machine first. Visit the link and go through with the suggested steps for your Operating System. A sample screenshot for that is shown below:

Press enter or click to view image in full size
Image

Ensure that the versions are correct and then install Gemini CLI as per the command given below:

npm install -g @google/gemini-cli

Once done, I suggest that you check the Gemini CLI version as follows:
gemini -v

On my system (at the time of writing), it shows the following: 0.22.5

Go ahead and launch Gemini CLI via the gemini command. Keep in mind that this is a client running in your terminal, so be comfortable with using the keyboard (Arrow keys, etc).

It would first ask you about choosing a theme. Go ahead and select one that you like:

Press enter or click to view image in full size
Image

Once selected, it asks you to select the Authentication method as shown below:

Press enter or click to view image in full size
Image

Go with the Google login, which will provide you access to the free tier of Gemini CLI, which allows for 60 requests/minute, 1000 model requests per day. This will invoke the browser, where you will need to login with your Google credentials for the account that you wish to use here. Once done, you should see `Gemini CLI` waiting for your command.

Press enter or click to view image in full size
Image

Alternately, if you need higher quota, feel free to provide your Gemini API Key or even Vertex AI, where you may have a Google Cloud Project with billing enabled. Do refer to the Authentication section of the documentation.

Preview Features

Gemini CLI has a setting that allows you to experience features that are first available in preview and are then rolled into general availability. I suggest that you enable this setting, so that you can use for e.g. Gemini 3 models in Gemini CLI (at the time of writing, this feature is in preview).

You can do that via the /settings command. This will bring up a configuration screen and you will see Preview Features as shown below. Follow the instructions for using keys to set this to true. Ideally restart Gemini CLI for the changes to take effect.

Press enter or click to view image in full size
Image

Gemini CLI Terminal Interface

Few things to immediately notice in the `Gemini CLI` terminal interface:

  1. Observe the bottom status bar. It has the currently folder shown to the left. The model (Auto (Gemini 3)) which the CLI will use. It is not running in a sandbox, which is a mechanism to isolate potentially dangerous operations (such as shell commands or file modifications) from your host system, providing a security barrier between AI operations and your environment.
  2. Type /help (forward slash) and you will see a variety of commands, keyboard shortcuts and how to use @ to specific files/folders that you would like to have in the context: Notice that you have the auth and the theme command that you will be familiar with since you did actually execute that at the time of installation. In case you wish to change the theme or the authentication method, you can invoke them anytime.
Press enter or click to view image in full size
Image

3. Need to refer the Gemini CLI documentation page, use the /docs command. It will lead you to the following page: https://geminicli.com/docs/

4. If you’d like to learn about your current session, model invocations, tool statistics, you can use the /stats command.

If you’d like to quit Gemini CLI, you can use the /quit command or press Ctrl-C twice.

Our first words with Gemini CLI

Notice that you can simply type in your message now and see Gemini CLI work for you. Let’s do that.

Let’s ask for help first and you guessed it correct, just give help without the forward slash. It did satisfactorily well to come up with this response, even though we did not provide it much context. It took some context based on the current folder, list of extensions installed and more. On my machine, I got the following output:

> help

✦ Hello! I'm your Gemini CLI agent, ready to help you with software engineering, application development, and Google Workspace tasks.

I can:
- Build & Refactor: Implement features, fix bugs, and refactor code across various languages.
- Explore Code: Map architectures and understand dependencies in large codebases.
- Automate Workspace: Manage your Gmail, Calendar, Docs, and Sheets.
- Run Commands: Execute shell commands, run tests, and manage deployments.
- Search & Info: Search the web, find places, and check weather.

What would you like to work on first?

As you would know by now, that Gemini CLI is an AI Agent integrated into your terminal, which means that it will be interacting with your environment to complete some of the tasks. This would include having access to your file system, reading/writing files and a lot more. We will be covering more of the tools that Gemini CLI comes with, but for now you can get a list of all the tools (not MCP Server tools) that are available to Gemini. Just give the /tools command, the output of which is given below:

Press enter or click to view image in full size
Image

What this means is that Gemini CLI will use any of these tools as required but do not worry at this point about it going all crazy with these tools without your permission to do things. You will notice that a tool usage will first result in Gemini prompting you for your permission to invoke the tool. We shall see this later in the series.

These tools are likely to increase in number or undergo changes in the way they work. Note that these are tools that come inbuilt with Gemini CLI. You can further expand Gemini CLI’s capabilities by installing Gemini CLI Extensions, which is how you enhance the current capability of Gemini CLI and give it access to your own tools/servers/data. We shall look at those later in the series.

Out of curiosity, I ask it what the GoogleSearch tool does:

> What does 'GoogleSearch' tool that you have do?

✦ The google_web_search tool allows me to perform live web searches to find information on the internet.

I can use it to:
- Look up the latest documentation or library versions.
- Research technical solutions or error messages.
- Find facts, news, or general information to help with your tasks.

Is there something specific you'd like me to search for?

Let’s give that a try with finding the latest news on India Cricket. Notice that in the output below, it picked up the GoogleSearch tool to get this information.

> Whats the latest news on India Cricket

✦ I will search for the latest news on Indian cricket to provide you with the most recent updates.
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ GoogleSearch Searching the web for: "latest news on India Cricket" │
│ │
│ Search results for "latest news on India Cricket" returned. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ Here are some of the latest updates regarding Indian cricket:

* Team News & Snubs: Devdutt Padikkal has expressed focus on continuing his domestic scoring streak after being left out of the ODI squad,
despite a strong Vijay Hazare Trophy performance.
* Coaching & Management: Harbhajan Singh has publicly backed Gautam Gambhir, urging the BCCI to show patience and warning against the
immediate adoption of "split coaching" roles.
* Player Updates: Mohammed Shami has reportedly been summoned for a SIR (Special Investigation Report) hearing in Kolkata. Additionally,
Ricky Ponting has offered advice to Suryakumar Yadav, encouraging him to play more freely to overcome a recent dip in form.
* International Relations: The ICC has reportedly turned down a request from the Bangladesh Cricket Board to move their T20 World Cup
matches away from India to Sri Lanka.
* IPL Buzz: Discussions continue around the BCCI’s decision-making regarding overseas player releases, specifically involving Mustafizur
Rahman and KKR.

Is there a specific player or tournament you'd like more details on?

Before we go ahead and give a command to Gemini CLI to create some content/application, it helps to understand the current working directory/folder again. Notice that at the bottom of the status bar to the left is the current folder. Not sure, what it is, you can swap to Shell mode by simply typing in !, this will toggle to shell mode as shown below.

The Shell or passthrough command is very interesting and it allow you to interact with your system’s shell directly from within Gemini CLI.

! pwd

It says shell mode enabled and I am typing the pwd command to understand where I am. The output is shown as below:

$ pwd
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell Command pwd │
│ │
│ /Users/romin/gemini-cli-projects │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

You can come out of the terminal mode, by hitting ESC key.

You can quit Gemini CLI via the /quit command and then ensure that you are in the folder that you would like to be and then launch gemini from there.

Start Gemini CLI from the folder you’d like to start with

Gemini CLI is a project based tool and expects that you typically start it from a folder in which you want to work in. So ideally you do not want to be in the home folder or at the root of some tree and then expect to go down into another folder. So be cognizant of this and launch Gemini CLI from a folder that you want to work from.

For e.g. on my system, my home folder is /Users/romin. I have created a root folder named /gemini-cli-projects in this folder. I then have multiple other folders that are like mini-projects that I am working on. For e.g. for this series I have created a folder inside of that named /cli-series and I am working off that.

Our first coding task

Let’s give Gemini CLI our first task and ask it to build a web application that displays the content of a current RSS feed. I follow Cricket with keen interest and for some reason, I am interested in viewing live scores of any match that is going on. Not sure why, but let’s leave that here.

Cricinfo.com provides a live feed of cricket scores over here: https://static.cricinfo.com/rss/livescores.xml. Let’s put Gemini CLI to the test and see how well it does on a sample web application that I’d like to create. Let’s go step by step.

Note that we are intentionally keeping things simple in this first part. In the next few parts, we shall look at what it means to configure the Gemini CLI as per your preferences, rules, context and more. For now, let’s just see what happens. So if you’ve heard about settings.json, GEMINI.md and other files, let’s wait a bit.

I begin with the following prompt:

 I would like to create a Python Flask Application that shows me a list of live scores of cricket matches. There is a RSS Feed for this that is available over here: 
https://static.cricinfo.com/rss/livescores.xml. Let's use that.

The next set of screens are ones that I got on my system. The output that you receive from Gemini CLI will differ and you can follow the prompts, give your permissions and other steps to keep moving forward.

Gemini CLI responds with the following:

✦ I will start by fetching the RSS feed to understand its structure, which will help me design the application correctly.
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ? WebFetch Processing URLs and instructions from prompt: "Fetch content from https://static.cricinfo.com/rss/livescores.xml so I can … ← │
│ │
│ Fetch content from https://static.cricinfo.com/rss/livescores.xml so I can see the structure of the RSS feed. │
│ │
│ URLs to fetch: │
│ - https://static.cricinfo.com/rss/livescores.xml │
│ │
│ Do you want to proceed? │
│ │
│ ● 1. Allow once │
│ 2. Allow for this session │
│ 3. No, suggest changes (esc) │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
⠏ Waiting for user confirmation...

You can see that it is planning to use one of the tools, WebFetch to first retrieve the RSS feed to understand its structure. You will also notice that it first asks you for the permission and you have a choice to allow it once or for the whole session. I’ll stick to Allow once for now, but it is completely upto you.

The next thing it plans is to create folder to hold the project files and I give it the go ahead by saying yes.

✦ I'll create a new directory called live-cricket-scores for this project.

Here is the plan:
1. Setup: Create the project directory and a Python virtual environment.
2. Dependencies: Install flask (web framework) and feedparser (to parse the RSS feed).
3. Application: Create app.py to fetch the data from the Cricinfo RSS feed.
4. UI: Create a simple HTML template using Bootstrap to display the live scores in a clean list format.
5. Run: Verify the application works.

Does this sound good?

Once it created the folders, it figured out the Python tools available on the system and went about its work to generate the files, install the dependencies and more. Here is a screenshot of it creating the app.py file.

Press enter or click to view image in full size
Image

It then goes ahead and creates a virtual environment in Python to setup the dependencies and then launches the server to test things out. You may notice errors like a specific port being in use (for e.g. it tried to start the server on port 5000 for me and that port was occupied). It tries to regroup and try out other strategies but that could get time consuming.

In such cases, feel free to interrupt the process and give your own instructions i.e. Use port 7000 instead or something like that.

Press enter or click to view image in full size
Image

Once the changes were done, it was able to launch the server successfully.

Press enter or click to view image in full size
Image

I visit the application locally at http://127.0.0.1:7000, a screenshot of which is shown below:

Press enter or click to view image in full size
Image

You can take a look at the app.py and the user interface code in /templates directory, if you’d like. Consider working with Gemini CLI to improve the code or add in your flavors by telling it to further work on the code via your prompts.

We have hardly scratched the surface here but feel free to take it for a spin. Try out some tasks or an application or two that you would like to see getting generated. It’s early days, so be ready for some surprises. I have found that I usually end up prompting again with more context or asking it to do better and more.

As we progress through this series, we will see a lot more of configuration, context setting and then when we come to various use cases, we will look at developing applications from scratch, migrating current applications, adding a feature or two to an existing application and more. So stay tuned.

Please consider leaving feedback

Thank you for reading! If you found this series helpful, please consider taking this 2-minute survey. Your feedback directly helps me create more tutorials for the developer community.

--

--

Google Cloud - Community
Google Cloud - Community

Published in Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Romin Irani
Romin Irani

Written by Romin Irani

Developer Advocate @ Google. My passion is to help developers succeed. ¯\_(ツ)_/¯

Responses (15)