A command-line interface, commonly abbreviated CLI, is a text-based method of interacting with a computer, operating system, application or network service by entering commands through a keyboard rather than manipulating graphical controls such as windows, icons and menus. A CLI normally presents a prompt indicating that it is ready to accept input, the user types a command and its arguments, and the system interprets the input and performs the requested operation or reports an error.
Commands can perform tasks ranging from creating and deleting files to configuring networks, installing software, compiling programs, querying databases and administering remote servers. A CLI is therefore an interaction mechanism rather than a particular program. Different operating systems and applications provide different command-line environments, and the commands accepted by one environment may not work in another.
The underlying model of a CLI is generally command invocation followed by textual input and output. A command may be a built-in operation supplied by the command interpreter, an executable program stored on the system, a script, an alias or another callable mechanism. Arguments modify what the command does, while options or switches select particular behaviours. For example, a command might specify a file path as an argument and use an option to request recursive processing.
The resulting output is commonly written as text to standard output, while diagnostic messages are commonly written to standard error. This separation allows programs to be combined systematically and allows output to be redirected into files or supplied to other programs rather than merely displayed on screen.
One of the most important characteristics of a CLI is composability. On systems with Unix-like command environments, the pipe mechanism allows the output of one program to become the input of another, enabling relatively small utilities to perform complex operations collectively. Redirection can send output to a file, read input from a file or combine streams, while command substitution can insert the result of one command into another command. Windows command environments provide their own forms of redirection and piping. These capabilities make CLIs particularly useful for repeatable administrative and development tasks because a sequence of operations can be represented as a script instead of manually performed through an interface. The command itself can become an executable record of the intended procedure.
CLIs have deep historical roots in early computing, when interactive text terminals and teletype devices were practical interfaces to computers that lacked modern graphical displays. Systems such as Unix subsequently established influential traditions of small command-line utilities, textual streams, pipes and shell scripting. The graphical user interface did not eliminate command lines; instead, both approaches developed alongside one another. Modern operating systems frequently provide sophisticated terminal applications that host command interpreters, and many graphical applications expose command-line tools for automation.
The word command historically refers to an instruction issued to a computer, while line reflects the original interaction model in which commands were entered as lines of text. Modern CLIs may support multiline input, interactive editors and rich terminal rendering, so the historical terminology is broader than its literal physical origins.
A CLI is particularly important in system administration, software development, DevOps, cloud computing, networking and automation. Administrators can use commands to inspect processes, examine logs, configure permissions, manage services and manipulate storage. Developers use command-line tools for source control, package management, compilation, testing, deployment and build automation. Cloud platforms commonly provide command-line utilities that turn operations normally performed through a web console into scriptable procedures. CLIs are also central to remote administration because a text-based session can consume substantially fewer resources than transmitting a complete graphical desktop. Secure remote protocols such as SSH consequently make command-line administration of servers practical even when the machine is geographically distant.
An important distinction is that a CLI is not synonymous with a terminal, shell or command prompt. A terminal is an application or interface that provides a text-based input and output environment, while a shell is software that interprets commands and launches programs. A command prompt can refer either to the visible prompt displayed by a shell or, in Windows terminology, to the Command Prompt program itself.
Bash is one particular shell, PowerShell is another, and utilities such as Python, Git and database clients can provide their own command-line interfaces. A terminal can therefore host a shell, and that shell can execute commands that themselves provide additional command-line interfaces. The layers are related but technically distinct.
CLIs have significant advantages in precision, automation, reproducibility and efficiency for experienced users. A command can specify an operation precisely, be copied into documentation, placed into a script, executed repeatedly and incorporated into an automated workflow. Large numbers of files or systems can often be processed with a single command or short script rather than through repetitive graphical actions. CLIs can also expose advanced functionality that is unavailable or less accessible through a graphical interface.
Their disadvantages include a steeper learning curve, poor discoverability for unfamiliar commands, potentially destructive consequences from incorrect input and differences in syntax between environments. A command may also be difficult to understand without knowledge of paths, permissions, quoting, escaping, environment variables and the relevant command interpreter.
Modern CLIs range from simple interactive prompts to sophisticated environments supporting scripting languages, programmable completion, colour, structured data, remote execution and integrated development workflows. Some tools produce traditional human-readable text, whereas others can return JSON, CSV or other machine-readable formats specifically for automation. Container systems, infrastructure tools, version-control systems and cloud platforms commonly rely heavily on CLIs because infrastructure can be represented as commands or declarative configuration.
The fundamental idea remains unchanged: the user or another program supplies textual instructions to a command-processing environment, which interprets those instructions and invokes the appropriate functionality. Understanding this model provides the conceptual foundation for distinguishing terminals, shells, Bash, PowerShell and the command-line tools that operate within them.