Command-line interface

Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternative to the non-interactive mode available with punched cards.

Automation is a more accessible option for programs that have CLIs, in contrast to purely graphical UI's, since many individual commands can be described together into single files called scripts.

Alternatives to CLIs include GUIs (most notably desktop metaphors with a mouse pointer, such as Microsoft Windows), text-based user interface menus (such as DOS Shell and IBM AIX SMIT), and keyboard shortcuts.

Automation of repetitive tasks is simplified by line editing and history mechanisms for storing frequently used sequences; this may extend to a scripting language that can take parameters and variable options.

Examples of command-line interpreters include Nushell, DEC's DIGITAL Command Language (DCL) in OpenVMS and RSX-11, the various Unix shells (sh, ksh, csh, tcsh, zsh, Bash, etc.

Under most operating systems, it is possible to replace the default shell program with alternatives; examples include 4DOS for DOS, 4OS2 for OS/2, and 4NT / Take Command for Windows.

[2] In 1964, MIT Computation Center staff member Louis Pouzin developed the RUNCOM tool for executing command scripts while allowing argument substitution.

[3] Pouzin coined the term shell to describe the technique of using commands like a programming language, and wrote a paper about how to implement the idea in the Multics operating system.

Although it is used as an interactive command interpreter, it was also intended as a scripting language and contains most of the features that are commonly considered to produce structured programs.

In November 2006, Microsoft released version 1.0 of Windows PowerShell (formerly codenamed Monad), which combined features of traditional Unix shells with their proprietary object-oriented .NET Framework.

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.

Some computer language systems (such as Python,[9] Forth, LISP, Rexx, and many dialects of BASIC) provide an interactive command-line mode to allow for rapid evaluation of code.

CLIs are often used by programmers and system administrators, in engineering and scientific environments, and by technically advanced personal computer users.

Depending on the environment, they may include colors, special characters, and other elements (like variables and functions for the current time, user, shell number or working directory) 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.

When a command processor is active a program is typically invoked by typing its name followed by command-line arguments (if any).

[24][25] Other languages, such as Python, expose operating system specific API (functionality) through sys module, and in particular sys.argv for command-line arguments.

Conversational Monitor System (CMS) uses a single left parenthesis to separate options at the end of the command from the other arguments.

[citation needed] To overcome this limitation, many CLI programs display a usage message, typically when invoked with no arguments or one of ?, -?, -h, -H, /?, /h, /H, /Help, -help, or --help.

Under DOS, where the default command-line option character can be changed from / to -, programs may query the SwitChar API in order to determine the current setting.

[20] Built-in usage help and man pages commonly employ a small syntax to describe the valid command form:[35][36][37][nb 2] Notice that these characters have different meanings than when used directly in the shell.

Because it must satisfy both the interactive and programming aspects of command execution, it is a strange language, shaped as much by history as by design.The term command-line interpreter (CLI) is applied to computer programs designed to interpret a sequence of lines of text which may be entered by a user, read from a file or another kind of data stream.

[nb 3] For business application programs, text-based menus were used, but for more general interaction the command line was the interface.

Around 1964 Louis Pouzin introduced the concept and the name shell in Multics, building on earlier, simpler facilities in the Compatible Time-Sharing System (CTSS).

[39][better source needed] From the early 1970s the Unix operating system adapted the concept of a powerful command-line environment, and introduced the ability to pipe the output of one command in as input to another.

The command line was also the main interface for the early home computers such as the Commodore PET, Apple II and BBC Micro – almost always in the form of a BASIC interpreter.

When more powerful business-oriented microcomputers arrived with CP/M and later DOS computers such as the IBM PC, the command line began to borrow some of the syntax and features of the Unix shells such as globbing and piping of output.

Conversely, scripting programming languages, in particular those with an eval function (such as REXX, Perl, Python, Ruby or Jython), can be used to implement command-line interpreters and filters.

For a few operating systems, most notably DOS, such a command interpreter provides a more flexible command-line interface than the one supplied.

There are a number of text mode games, like Adventure or King's Quest 1-3, which relied on the user typing commands at the bottom of the screen.

The text adventure The Hitchhiker's Guide to the Galaxy, a piece of interactive fiction based on Douglas Adam's book of the same name, is a teletype-style command-line game.

Screenshot of a sample Bash session in GNOME Terminal 3, Fedora 15
Screenshot of Windows PowerShell 1.0, running on Windows Vista
A graphical user interface with icons and windows ( GEM 1.1 Desktop )
GNU Octave 's GUI with command-line interface
Prompt of a BBC Micro after switch-on or hard reset
An MS-DOS command line, illustrating parsing into command and arguments
The end of the HELP command output from RT-11SJ displayed on a VT100
A Teletype Model 33 ASR teleprinter keyboard with punched tape reader and punch
DEC VT52 terminal