Translation(s): English - Fran├žais - Italiano

(!) ?Discussion


A command line interface or CLI is a method of interacting with a computer by giving it lines of textual commands (that is, a sequence of characters) either from keyboard input or from a script. It is occasionally also referred to as a CLUE, for Command Line User Environment. In its simplest form, the user types a command after the computer displays a prompt character. The computer system (that is, the program then accepting such input) then carries out the command given. The result may be textual output, or the initialization and running of some program, or a modification to the graphical output on a monitor or printer, or some change in a file system (for example, delete a file, modify a file, or create a file).

The term is usually used in contrast to a graphical user interface (GUI) in which commands are typically issued by moving a pointer (such as, a mouse cursor) and/or pressing a key (that is, by "clicking", often on a key mounted on a mouse).

Programs that implement these interfaces are often called command line interpreters. Examples of such programs include the various different shells, VMS DCL (Digital Command Language), and related designs like CP/M and DOS's command.com, both based heavily on DEC's RSX and RSTS operating system interfaces (which were also command line interfaces).

There are other programs which use CLI as well. The CAD program AutoCAD is a prominent example. In some computing environments like the Oberon operating system or Smalltalk user interface, most of the text which appears on the screen may be used for giving commands.

The commands given on a command line interface are often of the form

 doSomething how toAFile

or

 doSomething how < inputFile > outputFile

doSomething corresponds to a verb, how to an adverb (it describes how the command should be performed in this instance - for example, should it be particularly "verbose", or particularly "quiet") and toAFile to an object (often one or more files) against which the command should be run. The standalone '>' in the second example is a redirection character, telling the operating system (i.e., usually a command shell interpreter) to send the output of the previous commands (that is, those on the left of '>') to some other place (that is, the file named to the right of the '>'). Another common and important redirection character is the ?Vertical bar ('|'), which tells the CLI to treat the output of this command as the input of another; this can be a very powerful mechanism for the user, as explained under Pipe_(Unix) and Pipes_and_filters.

Advantages of a command line interface

Even though new users seem to learn GUI more quickly to perform common operations, well-designed CLIs have several advantages: