In a CLI the user types a command, a program name plus arguments, and gets a text response. This is how git, docker, ssh and Linux utilities such as grep and curl work. A text interface is easy to automate: the same commands go into scripts and CI unchanged.
What a command consists of
A typical command consists of a program name, arguments and options:
docker run --rm -p 8080:80 nginx:latest- The name says which program to call:
docker. - Positional arguments say what to work on:
run,nginx:latest. - Options (flags) say how to work:
--rmremoves the container after it stops,-p 8080:80publishes a port.
POSIX defines a command as a directive to the shell to perform a task, an argument as a parameter passed to a utility, and an option as an argument that changes its default behaviour. The shell (bash, zsh, PowerShell) prints a prompt, reads a line, parses it and runs the program; the output goes back to the screen.
Why the CLI lives on in automation
A program with a CLI returns an exit code: 0 means success, non-zero means an error. Commands are joined in a pipeline, where the output of one becomes the input of the next:
grep ERROR app.log | wc -lThat is why the CLI is the main interface for headless servers, scripts and CI/CD pipelines: whatever a person types by hand, a script repeats in the same way.
GUI and TUI
A GUI shows buttons and windows and is designed for the mouse; a CLI is designed for the keyboard and text. A TUI fills the whole terminal with windows and menus, as in htop, but remains text.
Sources
the term is written from these pages- POSIX.1-2017, Base Definitions, §3.105 Command Language Interpreterpubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html(opens in a new tab)
- GNU Bash Reference Manual, §1.2 What is a shell?gnu.org/software/bash/manual/html_node/What-is-a-shell_003f.html(opens in a new tab)
- GNU Coreutils Manual, §2.11 Exit statusgnu.org/software/coreutils/manual/html_node/Exit-status.html(opens in a new tab)
Verified 9 Nov