The Command Line Interface or CLI is an interface which accepts commands from the user, similar to Windows Command Prompt or Linux Terminal. Check also Text UI.
To implement a minimal CLI, an operating systems needs at least:
- Access to video memory
- Keyboard driver
- String input and comparison
- Some functions to execute on commands
Because of their ease of implementation, CLI's are popular in hobby OS projects.
- Speed and control
- Less resources needed
- Scripts to automate tasks
- No need for mouse devices and drivers
- Easily made compatible with serial lines and tcp sockets, so you can get your normal command environment when debugging display drivers or window system
- Copy/paste applies to every program because it's all just text
Some users with coordination, memory, and/or attention span issues find command lines much easier than navigating large menu trees, especially if the commands are relatively simple. (Don't underestimate the problem-solving skills of people with these issues. ;))
Use over a serial line, real or simulated, restricts available key combinations and usually introduces some bugs. Even the newest terminal emulators for POSIX systems operate over a simulated serial line. These bugs stem from 4 causes: in-band signalling, state mismatch, protocol incompatibilities, and unprintable characters.
State mismatch and in-band signalling issues impact smart command line interfaces more than 2D TUI because many programs use the same serial line without adequate multiplexing. See for example bash's behaviour when you start vi, resize the xterm, then quit vi. bash doesn't know about the changed size.
Protocol mismatch generally concerns the keyboard these days: few ANSI terminals implement the required VT-102 keyboard, but some do. Output incompatibilities are relatively common in terminal emulators from before about 2003-5, notably XTerm. Physical terminals may, of course, have bugs in ROM.
All these bugs could be mitigated by a proper terminal driver architecture, but this isn't how things are done in POSIX systems. Dumb terminals also mitigate the bugs by having no state and few control codes, and generally aren't entirely dumb. Most support backspace, allowing surprisingly good command-line editing with a bit of software support.
Some users simply have problems getting comfortable with CLIs. Two reasons for this are the need to spell input correctly, and the need to remember commands and their syntax. These reasons overlap: some users find it very hard to remember how to spell unfamiliar words or cryptic abbreviations. It can be hard to remember which specific abbreviation (of several reasonable possibilities) any one program uses. Quick help mitigates these issues, but most command-line programs in modern operating systems have so many features, their quick help exceeds both screen space and attention span of many potential users! It's not all bad, even such large quick help may be copy/pasted, as may text from other documentation. Both copy/paste and tab completion help poor typists enter commands and files. (See also "send"; a combination copy and paste found in some old window systems such as Plan 9's.)