A command-line interface (CLI) is a mechanism for interacting with a computer operating system or software by typing commands to perform specific tasks. A command-line interpreter then receives, parses, and executes the requested user command. Upon completion, the command usually returns output to the user in the form of text lines on the CLI. A program that implements such a text interface is often called a command-line interpreter, command processor or shell, whereby the term shell, often used to describe a command-line interpreter, can be in principle any program that constitutes the user-interface, including fully graphically oriented ones—for example, the default Windows GUI is created by a shell program named EXPLORER.EXE, as defined in the SHELL=EXPLORER.EXE line in the WIN.INI configuration file.
Screenshot of the MATLAB 7.4 command-line interface and GUI.In the case of operating systems (OS), MS-DOS and Unix each define their own set of rules that all commands must follow. A simple CLI will display a prompt, accept a "command line" typed by the user terminated by the Enter key, then execute the specified command and provide textual display of results or error messages. Advanced CLIs will validate, interpret and parameter-expand the command line before executing the specified command, and optionally capture or redirect its output.
Useful command lines can be saved by assigning a character string or alias to represent the full command, or several commands can be grouped to perform a more complex sequence — for instance, compile the program, install it, and run it — creating a single entity, called a command procedure or script which itself can be treated as a command. In some CLIs, the commands issued are not coupled to any conceptual place within a command hierarchy. A user can specify relative or absolute paths to any command or data. Examples of this include DOS, OS/2, Windows, and UNIX, which provide forms of a change directory command which allows access to any directory in the system. For example, if the CLI had two modes called interface and system, the user would enter the word 'interface' at the command prompt and then enter an interface mode, where a certain subset of commands and data are available. At this point system commands are not accessible and would not be accessible until the user explicitly exits the interface mode and enters the system mode.
Command promptA command prompt (or just prompt) is a sequence of (one or more) characters used in a command-line interface to indicate readiness to accept commands. In DOS's COMMAND.COM and in the Windows NT's command-line interpreter cmd.exe the prompt is modifiable by issuing a
promptcommand or by directly changing the value of the corresponding
could be set by issuing the command
[time] user@host: work_dir $
In RISC OS, the command prompt is a '
*' symbol, and thus (OS)CLI commands are often referred to as "star commands".
ArgumentsA command-line argument or parameter is an argument sent to a program being called. When a command processor is active a program is typically invoked by typing its name followed by command-line arguments (if any). For example, in Unix and Unix-like environments, an example of a command-line argument is:
Command-line optionA command-line option or simply option (also known as a flag or switch) modifies the operation of a command; the effect is determined by the command's program. Options follow the command name on the command line, separated by spaces. By appending the /owner option (to form the command directory/owner), the user can instruct the directory command to also display the ownership of the files.
Some command-line interpreters (including newer versions of DR-DOS COMMAND.COM and 4DOS) also provide pseudo-environment variables named %/% or %SWITCHAR% to allow portable batchjobs to be written.
Long path/Long program name Parameter one Parameter two...
Long_path/Long_program_name Parameter_one Parameter_two...,
"Long path/Long program name" "Parameter one" "Parameter two"...
Command-line interpreterA command-line interpreter (also called a command line shell, command language interpreter, or abbreviated as CLI) is a computer program that reads lines of text entered by a user and interprets them in the context of a given operating system or programming language.
Command-line interpreters allow users to issue various commands in a very efficient (and often terse) way.  For business application programs, text-based menus were used, but for more general interaction the command line was the interface.
From the early 1970s the Unix operating system on minicomputers pioneered the concept of a powerful command-line environment, which Unix called the "shell", with the ability to "pipe" the output of one command in as input to another, and to save and re-run strings of commands as "shell scripts" which acted like custom commands.
While most computer users now use a GUI almost exclusively, more advanced users have access to powerful command-line environments: