Terminal User Interfaces (TUIs): GUIs for the Console
A TUI is a graphical interface built from text, offering rich interactivity without leaving the console. Use them for system monitoring (btop), file management, or database clients. The footgun: don't confuse them with CLIs; TUIs are stateful apps.
Why it exists
Simple command-line interfaces (CLIs) are powerful for scripting but clumsy for tasks requiring constant visual context, like monitoring a server or navigating a complex directory. TUIs were created to provide a richer, interactive experience directly in the terminal, blending the speed and low resource usage of the console with the usability of a graphical interface.
The mental model
Think of a TUI as a GUI for your terminal. It's an application that takes over the terminal screen, drawing its own interface using text characters, colors, and block elements. Unlike a desktop app, it needs no separate window manager or graphics server. It's a self-contained, stateful application living entirely within your terminal session.
How it works
TUIs are built with libraries (like Bubble Tea in Go or tui-rs in Rust) that abstract away raw terminal control codes. These libraries let developers position the cursor, set colors, draw boxes, and listen for keyboard or mouse events. The application runs in a continuous loop, redrawing the screen in response to user input or background data changes, creating the illusion of a dynamic interface.
When to use it
Use a TUI for tools that benefit from a persistent visual context and keyboard-centric navigation, especially over SSH. They are ideal for system resource monitors (btop), interactive database clients, Git clients (lazygit), and container management dashboards (k9s). They are fast, lightweight, and work well in low-bandwidth environments.
When not to use it
Avoid TUIs for tasks that are easily scriptable or fit into a standard Unix pipeline (like grep or sed). If your application needs complex graphics, rich media, or is intended for non-technical users who are unfamiliar with terminals, a native GUI or web interface is a much better choice.
One canonical example
btop++ is a modern resource monitor that perfectly exemplifies a TUI. It displays CPU, memory, disk, and network usage in real-time using graphs, meters, and sortable process lists. It is fully interactive, supporting keyboard and mouse input to change views, filter processes, and send signals, providing an experience comparable to a graphical activity monitor.
Interview question
What is a key characteristic that distinguishes a Terminal User Interface (TUI) from a simple Command-Line Interface (CLI)?
- a.TUIs operate as self-contained, stateful applications providing a continuous interactive display.Correct
- b.TUIs require a separate window manager or graphics server to render their visual elements.
- c.TUIs are primarily designed for scripting and automation of repetitive tasks.
- d.TUIs are limited to displaying static text output and do not support real-time updates.
Why? this is the answer
The card defines a TUI as a "self-contained, stateful application" that provides a "richer, interactive experience" and "persistent visual context." This contrasts with CLIs, which are powerful for scripting but less suited for continuous visual interaction. TUIs do not require a separate window manager or graphics server, and they are designed for dynamic, real-time updates.
Just read this? Test yourself on what you have been reading.
Read the original → github.com
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles