Information about Command Line Interface

Enlarge picture
Screenshot of a sample Bash session, taken on Gentoo Linux.
Enlarge picture
Screenshot of the MS-DOS command line interface.
Enlarge picture
Screenshot of Windows PowerShell RC 1, running under Windows Vista


A command line interface or CLI is a method of interacting with an operating system or software using a command line interpreter. This command line interpreter may be a text terminal, terminal emulator, or remote shell client such as PuTTY.

The concept of the CLI originated when teletype machines (TTY) were connected to computers in the 1950s, and offered results on demand, compared to 'batch' oriented mechanical punch card input technology. Dedicated text-based CRT terminals followed, with faster interaction and more information visible at one time, then graphical terminals enriched the visual display of information. Currently personal computers encapsulate both functions in software.

The CLI continues to coevolve with graphical user interfaces (GUIs) like those provided by Microsoft Windows, Mac OS and the X Window System. In some applications, such as MATLAB, a CLI is integrated with the GUI, with the benefits of both.

Usage

A CLI is used whenever a large vocabulary of commands or queries, coupled with a wide (or arbitrary) range of options, can be entered more rapidly as text than with a pure GUI.

CLIs are often used by programmers and system administrators, in engineering and scientific environments, and by technically advanced personal computer users. CLIs are also popular among people with visual disability, since the commands and feedbacks can be displayed using Refreshable Braille displays.

A program that implements such a text 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, the latter two based heavily on DEC's RSX and RSTS CLIs.

In November 2006, Microsoft released version 1.0 of Windows PowerShell (formerly codenamed Monad), which combined features of traditional Unix shells with their object-oriented .NET Framework. MinGW and Cygwin are open source packages for Windows that offer a Unix like CLI. Microsoft provides MKS Inc.'s ksh implementation MKS Korn shell for Windows through their Services for UNIX add-on.

The latest versions of the Macintosh operating system are based on a variation of UNIX called Darwin. On these computers, users can access a UNIX-like command line interface called Terminal found in the Applications Utilities folder.
Enlarge picture
Screenshot of the MATLAB 6.5 command line interface and GUI.
Some applications provide both a CLI and a GUI. 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.

Anatomy of a CLI

A CLI can generally be considered as consisting of syntax and semantics. The syntax is the grammar that all commands must follow. In the case of operating systems (OS), MS-DOS and UNIX each define their own set of rules that all commands must follow. In the case of embedded systems, each vendor, such as Nortel, Juniper Networks or Cisco Systems, defines their own proprietary set of rules that all commands within their CLI conform to. These rules also dictate how a user navigates through the system of commands. The semantics define what sort of operations are possible, and on what sort of data these operations can be performed.

Two different CLIs may agree on either syntax or semantics, but it is only when they agree on both that they can be considered sufficiently similar to allow users to use both CLIs without needing to relearn anything as well as enable re-use of scripts.

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.

Unlike a button or menu item in a GUI, a command line is typically self-documenting, stating exactly what the user wants done. In addition, command lines usually include many defaults that can be changed to customize the results. 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. These advantages mean that a user must figure out a command or series of commands only once, because they can be saved, to be used again.

The commands given to a CLI are often in one of the following forms:
  • [doSomething] [how] [toFiles]
  • [doSomething] [how] [sourceFile] [destinationFile]
  • [doSomething] [how] < [inputFile] > [outputFile]
  • [doSomething] [how] | [doSomething] [how] | [do Something] [how] > [outputFile]
doSomething is, in effect, 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 third example is a redirection operator, 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 operator 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.

CLI and Resource Protection

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 MS-DOS and UNIX/Windows, which provide forms of a change directory command which allows access to any directory in the system. Protection of resources is provided by a system of resource ownership by privileged groups, and password-protected user accounts which are members of specific groups. MS-DOS provides no such resource protection.

Other CLIs (such as those in routers) limit the set of commands that a user can perform to a subset, determined by location within a command hierarchy, grouped by association with security, system, interface, etc. The location within this hierarchy and the options available are often referred to as a mode. In these systems the user might traverse through a series of sub-hierarchies, each with their own subset of commands. 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.

Command prompt

A 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. Its intent is to literally prompt the user to take action. A prompt usually ends with one of the characters $, %, #, :, > and often includes other information, such as the path of the current working directory.

It is common for prompts to be modifiable by the user. Depending on the environment, they may include colors, special characters, and other elements like the current time, in order, for instance, to make the prompt more informative or visually pleasing, to distinguish sessions on various machines, or to indicate the current level of nesting of commands.

In DOS's COMMAND.COM and in the Windows command line interpreter cmd.exe the prompt is modifiable by issuing a prompt command or by changing the value of the %PROMPT% environment variable. The default C:\> style is obtained, for instance, with "prompt $P$G".

On many Unix systems, the $PS1 variable can be used, although other variables also may have an impact on the prompt (depending on what shell is being used). In the bash shell, a prompt of the form
[time] user@host: work_dir $
could be set by issuing the command
export PS1='[\t] \u@\H: $(pwd) $'


In zsh the $RPROMPT variable controls an optional "prompt" on the right hand side of the display. It is not a real prompt in that the location of text entry does not change. It is used to display information on the same line as the prompt, but right justified.

Quotes

"IBM wanted CP/M prompts. It made me throw up."


"It was a mistake to think that GUIs ever would, could, or even should, eliminate CLIs."

References

See also

External links

An operating system (OS) is the software that manages the sharing of the resources of a computer. An operating system processes system data and user input, and responds by allocating and managing tasks and internal system resources as a service to users and programs of the
..... Click the link for more information.
Computer software is a general term used to describe a collection of computer programs, procedures and documentation that perform some task on a computer system. [1]
..... Click the link for more information.
command line interpreter (also command line shell, command language interpreter) 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.
..... Click the link for more information.
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system. A computer terminal is an instance of a human-machine interface(HMI).
..... Click the link for more information.
Putty is a generic term for a plastic material similar in texture to clay or dough typically used in domestic construction and repair as a sealant or filler. Painter's Putty
..... Click the link for more information.
A teleprinter (teletypewriter, Teletype or TTY for TeleTYpe/TeleTYpewriter) is a now largely obsolete electro-mechanical typewriter which can be used to communicate typed messages from point to point through a simple electrical
..... Click the link for more information.
worldwide view.


2nd millennium
Centuries: 19th century - 20th century - 21st century

1920s 1930s 1940s - 1950s - 1960s 1970s 1980s
1950 1951 1952 1953 1954
1955 1956 1957 1958 1959

- -
- The 1950s
..... Click the link for more information.
punch card or punched card (or punchcard or Hollerith card or IBM card), is a piece of stiff paper that contains digital information represented by the presence or absence of holes in predefined positions.
..... Click the link for more information.
1. Electron guns 2. Electron beams 3. Focusing coils 4. Deflection coils 5. Anode connection 6. Mask for separating beams for red, green, and blue part of displayed image 7.
..... Click the link for more information.
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system. A computer terminal is an instance of a human-machine interface(HMI).
..... Click the link for more information.
co-evolution is the mutual evolutionary influence between two species. Each party in a co-evolutionary relationship exerts selective pressures on the other, thereby affecting each others' evolution.
..... Click the link for more information.
graphical user interface (GUI) is a type of user interface which allows people to interact with a computer and computer-controlled devices which employ graphical icons, visual indicators or special graphical elements called "widgets", along with text, labels or text
..... Click the link for more information.
Microsoft Windows

Screenshot of Windows Vista Ultimate, the latest version of Microsoft Windows.
Company/developer: Microsoft Corporation
OS family: MS-DOS/9x-based, Windows CE, Windows NT
Source model: Closed source

..... Click the link for more information.

..... Click the link for more information.
X Window System (commonly X11 or X) is a display protocol which provides windowing on bitmap displays. It provides the standard toolkit and protocol to build graphical user interfaces (GUIs) on Unix-like operating systems and OpenVMS, and has been ported to all other
..... Click the link for more information.
MATLAB is a numerical computing environment and programming language. Created by The MathWorks, MATLAB allows easy matrix manipulation, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs in other languages.
..... Click the link for more information.
A refreshable Braille display or Braille terminal is an electro-mechanical device for displaying Braille characters, usually by means of raising dots through holes in a flat surface. Blind computer users who cannot use a normal computer monitor use it to read text output.
..... Click the link for more information.
command line interpreter (also command line shell, command language interpreter) 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.
..... Click the link for more information.
In computing, a shell is a piece of software that provides an interface for users. Typically, the term refers to an operating system shell which provides access to the services of a kernel.
..... Click the link for more information.
Unix shell, also called "the command line", provides the traditional user interface for the Unix operating system and for Unix-like systems. Users direct the operation of the computer by entering command input as text for a shell to execute.
..... Click the link for more information.
CP/M is an operating system originally created for Intel 8080/85 based microcomputers by Gary Kildall of Digital Research, Inc. Initially confined to single tasking on 8-bit processors and no more than 64 kilobytes of memory, later versions of CP/M added multi-user variations, and
..... Click the link for more information.
DOS (from Disk Operating System) commonly refers to the family of closely related operating systems which dominated the IBM PC compatible market between 1981 and 1995 (or until about 2000, if Windows 9x systems are included): DR-DOS, FreeDOS, MS-DOS, Novell-DOS, OpenDOS, PC-DOS,
..... Click the link for more information.
COMMAND.COM is the filename of the default operating system shell (or command line interpreter) for DOS and 16/32bits versions of Windows (95/98/98 SE/Me). It also has an additional role, as the first program run after boot, hence being responsible for setting up the system by
..... Click the link for more information.
Digital Equipment Corporation was a pioneering American company in the computer industry. It is often referred to within the computing industry as DEC. (This acronym was frequently officially used by Digital itself,[1] but the official name was always DIGITAL.
..... Click the link for more information.
RSX-11 is a family of real-time operating systems mainly for PDP-11 computers created by Digital Equipment Corporation (DEC), common in the late 1970s and early 1980s. It was designed for and much used in process control, but was also popular for program development.
..... Click the link for more information.
RSTS/E (an acronym for Resource Sharing Timesharing System Extended) was a multi-user time-shared operating system developed by Digital Equipment Corporation ("DEC") (now part of Hewlett Packard) for the PDP-11 series of 16-bit minicomputers, and used primarily during the
..... Click the link for more information.
Microsoft Corporation

Public (NASDAQ:  MSFT )
Founded Albuquerque, New Mexico, USA (April 4 1975)[1]
Headquarters Redmond, Washington, United States

Key people Bill Gates, Co-founder and Executive Chairman ;
Paul Allen, Co-founder ;
..... Click the link for more information.
Windows PowerShell, previously Microsoft Shell or MSH (codenamed Monad) is an extensible command line interface (CLI) shell and scripting language product developed by Microsoft. The product is based on object-oriented programming and version 2.
..... Click the link for more information.
.NET Framework is a software component that can be added to or is included with Microsoft Windows operating system. It provides a large body of pre-coded solutions to common program requirements, and manages the execution of programs written specifically for the framework. The .
..... Click the link for more information.
MinGW is a software port of the GNU toolchain to Microsoft Windows. MinGW includes a set of header files (for the Windows API) which allows developers to use GCC, a free compiler, to create native Windows programs which do not rely on the presence of a runtime emulating Unix-like
..... Click the link for more information.


This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus


page counter