Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What’s the difference between a TUI and a CLI?

(Also my preferred TUI acronym is tactile user interface).



Both use the terminal, but in different ways. A CLI interface uses the basic terminal functionality of writing and perhaps reading lines, or even simply accepting flags and running non-interactively. A TUI uses the terminal's advanced features, using the terminal as the basis for a kind of GUI, generally occupying the full area of the terminal.

Vim, Midnight Commander, and htop have TUIs. They rely heavily on the terminal's 'control character' features to accomplish this. apt-get has a CLI, as its interactive IO is handled with printing lines and having the user submit lines (even if it's just the letter y).

Somewhere in the middle are interfaces like bash and zsh which make light use of the terminal's advanced features for things like auto-complete, but which don't take over the whole terminal area.

I'd count non-interactive applications like gcc and sort as command-line applications, although strictly speaking you could just as well use a graphical interface to configure their flags and run commands.

See also https://en.wikipedia.org/wiki/Text-based_user_interface


If a CLI program ceases to make sense when its standard-output is a physical line-printer onto a roll of paper, then it's a TUI.


God these explanations suck. Reminds me of the "two boats meet in an ocean" explanation of IRC.

A CLI (command line interface) just uses the streams to show and take in data.

A TUI uses escape codes or proprietary console commands (the latter on Windows, the former on most other things) to take control of the entire console window and display a user interface (hence Text User Interface or TUI). Usually mouse input is handled on modern systems too.


CLI refers to interacting with a program by typing commands. Commands need not come from a terminal (a terminal need not even exist). They might be just passed in from a different program.

TUI refers to interacting with a program via the terminal—the terminal is the program's user interface (think 'nano', which you can't really run without a terminal). The terminal need not interact via commands, although many TUI programs also accept commands.



I would say that a CLI is primarily for entering commands, while a TUI is primarily for viewing and interacting with data.


Back in the MS-DOS days a TUI would be something done with Turbo Vision or Clipper, simulating GUIs with text.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: