Want to use Google’s powerful Gemini AI model right from your Ubuntu terminal? With the Gemini CLI Ubuntu tool, you can—no browser needed. This official command-line interface lets developers and power users interact with Gemini through text prompts, automate tasks, and integrate AI into scripts—all from the comfort of their terminal.
The Gemini CLI Ubuntu installation is straightforward and works on Ubuntu 22.04, 24.04, and other Debian-based systems. Here’s how to set it up in minutes.
First, ensure you have Python 3.9 or newer and pip installed. Most modern Ubuntu versions include these by default. Open a terminal and run:
bash12
If either is missing, install them with:
bash1
Next, install the official google-gemini-cli package using pip:
bash1
This command downloads and installs the CLI along with its dependencies. Once complete, verify the installation:
bash1
You’ll see usage instructions—but before you can generate responses, you need an API key. Go to the Google AI Studio website, sign in with your Google account, and navigate to “API” under “Get started.” Click “Create API key,” copy it, and store it securely.
Now, configure the CLI with your key. Run:
bash1
When prompted, paste your API key. The tool saves it in a local config file (~/.config/gemini/config.json), so you won’t need to enter it again.
You’re ready to use Gemini! Try a simple query:
bash1
The AI will respond directly in your terminal. You can also pipe input, use it in shell scripts, or enable streaming for real-time output with the --stream flag.
For example, to summarize a log file:
bash1
Keep in mind: the Gemini CLI Ubuntu tool requires an internet connection and consumes your free or paid API quota. Free tier includes generous usage limits, but monitor your usage in Google Cloud Console if you scale up.
Additionally, make sure your system clock is accurate—SSL/TLS errors may occur if time is off by more than a few minutes. You can sync it with:
bash1
While not officially packaged for APT, the pip-based install ensures you always get the latest version. To update later, just run:
bash1
In summary, installing Gemini CLI Ubuntu unlocks instant, scriptable access to one of the world’s most advanced AI models. Whether you’re debugging code, analyzing data, or automating workflows, having Gemini in your terminal boosts productivity without leaving the command line.
READ: How to Run Affinity on Linux Despite No Official Support





