Command-Line Interface
A command-line interface, or CLI, is a way of operating a computer by typing lines of text that name a program and its options, then reading the text it prints back. Instead of choosing from menus, a person writes something like a program name, a flag and a file name, presses Enter, and the system runs exactly that request, so the interface is essentially a small, precise language for giving instructions rather than a set of pictures to click.
The style descends directly from the teletype. Early interactive computers were reached through electromechanical teleprinters such as the Teletype Model 33, introduced in 1963 and widely used on minicomputers, which typed what the user entered on paper and printed the machine's reply one line at a time. Unix, created at Bell Labs by Ken Thompson and Dennis Ritchie from 1969, grew up on such devices, which is why its commands are short and terse and why its vocabulary still includes tty, short for teletype. Ken Thompson wrote the first Unix shell, and Stephen Bourne's shell of 1979 became the standard ancestor of the scripting shells in use today. The same line-at-a-time model passed into CP/M and MS-DOS, and from there into the Windows command prompt and PowerShell.
A command line has a regular grammar: a command, options and arguments. The first word names the program to run, flags (such as a single letter after a dash or a long name after two dashes) modify its behaviour, and the remaining words are the things to act on, such as files. The shell, the program that reads the line, splits it into words, expands wildcards and variables, finds the program and starts it, then waits for it to finish and reports its exit status, a number where zero conventionally means success. Because the conventions are so uniform, a person who learns the pattern can use thousands of tools, and the built-in help (a help flag or the Unix man page) documents each one.
The CLI's lasting advantage is composition. Doug McIlroy proposed connecting programs with pipes, introduced in Unix in 1973, so that the output of one tool becomes the input of the next, and the Unix philosophy followed: small programs that each do one thing and communicate through plain text. A pipeline like the one above needs no special program for counting error types; it is assembled from parts in seconds and can be saved as a script. Text commands can also be recorded, searched in history, versioned in Git, copied into documentation, scheduled by cron and run on a remote server over SSH, none of which is natural for a sequence of mouse clicks.
The CLI is thus central to modern software development and data work. Git, Docker, kubectl, pip, npm, the cloud providers' tools and countless machine-learning utilities are driven from the command line, and a training run on a remote GPU cluster is usually launched, monitored and stopped through it. Command-line programs are also easy to test, because a command and its arguments fully specify an invocation, and well-designed ones follow conventions such as reading from standard input, writing results to standard output and errors to a separate stream, and returning meaningful exit codes, which is what lets them be composed.
The CLI is often called obsolete or only for experts, and both claims are misleading. Its weakness is discoverability: nothing on the screen shows which commands exist, mistakes can be destructive (a single misplaced character in a delete command has erased many directories), and the learning curve is steep at the start. Its strength is speed and precision once the vocabulary is known. It is also frequently confused with the terminal and the shell: the command-line interface is the style of interaction, the shell is the program that interprets the commands, and the terminal is the window or device through which the text travels.
Read the command-line interface as a conversation in a small formal language: a typed sentence of command, options and arguments goes in, text comes back, and because each sentence is just text, it can be saved, repeated, chained to others and run by a machine as easily as by a person.