We're excited to announce an enhancement to Gemini CLI that makes your workflow more powerful and familiar. We've upgraded the terminal to allow you to run complex, interactive commands—like vim for editing, top for monitoring, or even an interactive git rebase -i—all directly within Gemini CLI. You no longer have to jump to a separate terminal or deal with an agentic CLI that “hangs” for interactive commands. Everything stays right where you are.
This matters because everything now remains within Gemini CLI’s context. Previously, you would have had to exit Gemini CLI to run interactive shell commands. More importantly, these commands were being run outside Gemini CLI’s context. By introducing pseudo-terminal (PTY) support, commands that require rich capabilities– such as text editors, system monitors, or reliance on terminal control codes, can now all be run from within Gemini CLI and within its context.
Now, when you run a shell command, Gemini CLI spawns a new process within a pseudo-terminal in the background, leveraging the node-pty
library. The PTY acts as an intermediary, providing the necessary interface for the operating system to recognize the session as a terminal. This allows applications and commands to be run as they were naturally designed to.
So how does this virtual terminal running in the background show up on your screen? Think of it like a video stream. Our new serializer takes a snapshot of the pseudo terminal at every moment—capturing every piece of text, every color, and even the cursor's position. These snapshots are then streamed to you, allowing you to see and interact with the terminal application in real-time. It's not just a stream of text; it's a live feed.
This new architecture enables two-way communication. We've added new capabilities to write input to the terminal and even resize it on the fly. When you type, your keystrokes are sent to the running process, and when you resize your window, the application inside Gemini's shell will adapt its layout, just like in a native terminal. You can focus on the terminal by pressing ctrl+f.
We've also improved our output handling to correctly render colorful terminal output, so you can enjoy your favorite command-line tools in all their glory.
The new interactive shell is enabled by default in Gemini CLI as of v0.9.0.
Upgrade to the latest version using the following command:npm install -g @google/gemini-cli@latest
For more information please refer to the official Gemini CLI documentation.
Here are a few examples of the type of commands you can now run with the interactive shell:
This is a major step for our shell integration, and we are actively working to refine input handling across all platforms. We encourage you to share your feedback on our GitHub repository if you encounter any inconsistencies.
Try it out and let us know what you think!