
Follow ZDNET: Add us as a preferred source on Google.
ZDNET’s key takeaways
- Gemini CLI brings Gemini AI directly to the Linux terminal.
- Setup requires Node.js and npm, but installation is straightforward.
- You can run queries, code, and manage tasks without a browser.
AI has finally started to trickle into the Linux command line. Thanks to the likes of Ollama, this reality is no longer avoidable: it’s here, and it’s not going anywhere. That’s not to say you have to use AI in your Linux terminal, but you can. For those who benefit from AI and often use the Linux command-line interface (CLI), the combination of the two can be a very powerful productivity boost.
Yes, you can get the power of Gemini AI directly in your Linux terminal.
Also: Gemini vs. Copilot: I tested the AI tools on 7 everyday tasks, and it wasn’t even close
Gemini CLI is a locally installed tool that can be used for a wide range of tasks, such as content generation, problem-solving, deep research, and even task management. Although the original focus of Gemini CLI was on developers, it can also be used by end users who want to access AI without having to use a web browser or a third-party GUI.
The problem with Gemini CLI is that it’s a bit tricky to install. Fortunately, I’m here to help you with that.
What makes Gemini CLI a game-changer?
One of the reasons why Gemini is a game-changer is that it’s the first command-line-driven AI tool that can work with different types of information, such as text, images, audio, video, and more. On top of that, it’s the first tool that brings the power of Gemini to the command line, while also having access to commands on your Linux system.
Also: Gemini just aced the world’s most elite coding competition – what it means for AGI
Because of that, you will certainly want to use Gemini CLI with caution. You wouldn’t want to give it access to sensitive information, which is why I’ll demonstrate how to use it within a specific directory.
Gemini also includes built-in tools for Google Search grounding, file operations, shell commands, web fetching, and more. It also supports custom integrations.
The free tier of Gemini CLI gives you 60 requests per minute, and 1,000 requests per day (using your personal Google account).
How to install Gemini CLI on Ubuntu
What you’ll need: The only things you’ll need are a running instance of Ubuntu Linux (or a distribution based on Ubuntu), a user with sudo privileges, and a working Google account. Make sure you’ve already signed in to your Google account with your default web browser before running Gemini CLI for the first time.
Next, we’re going to install Node.js (because Gemini CLI is installed with the Node.js package manager, npm). To install Node.js, issue the command:
sudo apt-get install nodejs -y
Now, we can install npm with the command:
sudo apt-get install npm -y
I’ve come across several pieces of documentation that instruct how to install Gemini CLI with npm, but many of them wind up with the gemini command not found. The only sure way to install Gemini CLI properly is with the command:
sudo npm install -g @google/gemini-cli
When that finishes, you’re ready to run Gemini.
Also: The best free AI for coding in 2025 – only 3 make the cut now
Note: If you get an error when trying to run Gemini, you might have to install the latest version of Node.js, which can be done with the following commands:
curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh
sudo -E bash nodesource_setup.sh
sudo apt-get install nodejs -y
After running the above, you’ll have to reinstall npm with:
sudo apt-get install npm -y
Gemini first run steps
1. Run Gemini
The first thing you must do is run Gemini with the command:
gemini
2. Select your theme
Gemini will prompt you to select a theme. Since this is a curses-based application, use your arrow keys to select the theme you want, then hit Enter on your keyboard.
Also: Google’s new Jules Tools is very cool – how I’m using it and other Gemini AI CLIs
You can select from any one of the included themes.
Jack Wallen/ZDNET
3. Select your authentication method
You read that right: you have to log in with your Google account. There are other ways to authenticate (Gemini API Key or Vertex AI), but using your Google account is the easiest method. Make sure “Login with Google” is selected, then hit Enter on your keyboard.
Also: My 8 must-use Linux commands, and how they can make your life easier
I would recommend using the Google Authentication method, as it’s the easiest.
Jack Wallen/ZDNET
4. Authenticate
When you hit Enter on your keyboard, your default web browser will open, where you can select the Google account you want to use. Once you’ve authenticated, the terminal window will change to a Gemini prompt, where you can type your first query.
Also: 7 Linux commands I can’t live without after 20 years in the terminal
You are now ready to run your first query.
Jack Wallen/ZDNET
Using the Gemini command line tool
Now that the Gemini CLI has been installed, let’s find out how to use it.
Also: The first 8 Linux commands every new user should learn
This is actually quite simple. You should first create a specific directory for your new project, such as:
mkdir ~/GEMINI
Change into that directory with:
cd ~/GEMINI
Now, run Gemini with the command:
gemini
You could also instruct Gemini to use a specific LLM. For example, since I’m going to ask it a programming question, I might want to use the qwen3-coder model. Instruct Gemini to use the model with the command:
gemini -m qwen3-coder
Now, you can type a standard query. I’ll demonstrate with the following:
Show me how to write a Python module
You might notice that Gemini can get a bit snarky as it runs your query. For instance, during my query it wrote out:
Rickrolling my boss.
Depending on your query, Gemini will require access to specific commands or request that you apply changes. This happened several times during my test query (about Python modules). As Gemini did its thing, it printed out step-by-step instructions on how to write a Python module.
Also: 10 Linux tips I give to both beginners and professionals for improved productivity
Depending on your query, Gemini might require permissions to run commands.
Jack Wallen/ZDNET
When the query was completed, I found the example Python module in the ~/GEMINI folder, which included the module Gemini created as an example. Gemini also printed out a summary on what it did to create the Python module sample I requested.
Gemini completed the task and now it’s time for me to learn something.
Jack Wallen/ZDNET
When you’re done using Gemini, hit Ctrl+C twice to exit.
And that is how you install and use the Gemini CLI tool on Linux. Enjoy the power of AI in your terminal.