Jump to content

Command-line interface

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 83.70.215.39 (talk) at 17:20, 17 August 2006 (External links). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Screenshot of a sample Bash session, taken on Gentoo Linux.
File:Msdos.gif
Screenshot of the MS-DOS command line interface.
File:PowerShell.PNG
Screenshot of Windows PowerShell RC 1, running under Windows Vista
File:Aux.jpeg
Screenshot of Apple Computer's CommandShell, taken on A/UX 3.0.1.

A command line interface or CLI is a method of interacting with a computer via a text terminal. Commands are entered as lines of text (that is, sequences of typed characters) from a keyboard, and output is also received as text. CLIs originated when teletype machines were connected to computers in the 1950s. In terms of immediate interaction and feedback, they represented an advance over the use of punch cards.

With the use of CRTs as interface devices, CLIs began evolving toward graphical user interfaces (GUIs) like Microsoft Windows, Mac OS, and the X Window System and were largely supplanted by GUIs when Microsoft, in response to the success of Apple's release of the Macintosh OS in 1984, introduced Windows the following year. Nevertheless, a significant minority of computer users prefer to use CLIs, because they feel that CLIs provide an environment with enhanced productivity. They are most often used by programmers and system administrators, especially in Unix-based operating systems; in engineering and scientific environments; and by a smaller subset of technically advanced home users. CLIs are also popular among people with visual disability.

In its simplest form, a CLI displays a prompt, the user types a command on the keyboard and terminates the command (usually with the Enter key), and the computer executes the command, providing textual output.

A program that implements such interface is often called a command line interpreter or shell. Examples include the various Unix shells (sh, ksh, csh, tcsh, bash, etc.), the historical CP/M, and DOS's command.com ("Command Prompt"), the latter two based heavily on DEC's RSX and RSTS CLIs. In late 2006, Microsoft plans to release Windows PowerShell (formerly codenamed Monad), which hopes to combine features of traditional Unix shells with their object-oriented .NET Framework. Windows' current CLI programs like DOS and Windows Script Host are commonly considered inadequate or insecure. MinGW is a third-party software for Windows that offers a true Unix CLI.

Some applications provide both a CLI and a GUI. One example is the CAD program AutoCAD. The engineering/scientific numerical computation package MATLAB provides no GUI for some calculations, but the CLI can handle any calculation. The three-dimensional-modelling program Rhinoceros 3D (used to design the cases of most cell phones, as well as thousands of other industrial products) provides a CLI (whose language, by the way, is distinct from Rhino's scripting language). In some computing environments, such as the Oberon or Smalltalk user interface, most of the text which appears on the screen may be used for giving commands.

The commands given to a CLI are often of the form

[doSomething] [how] [toFiles]

or

[doSomething] [how] < [inputFile] > [outputFile]

doSomething is in effect to a verb, how an adverb (for example, should the command be executed "verbosely" or "quietly") and toFiles an object or objects (typically one or more files) on which the command should act. The '>' in the second example is a redirection character, telling the command line interpreter to send the output of the command not to the screen but to the file named on the right of the '>'. Another redirection character is the pipe ('|'), which tells the CLI to use the output of one command as the input to the next command; this "operator-stream" mechanism can be very powerful.

See also