Command-line interface

From Wikipedia for FEVERv2
(Redirected from Command-line interpreter)
Jump to navigation Jump to search

A command-line interface (CLI) processes commands to a computer program in the form of lines of text. Command-line interface_sentence_0

The program which handles the interface is called a command-line interpreter or command-line processor. Command-line interface_sentence_1

Operating systems implement a command-line interface in a shell for interactive access to operating system functions or services. Command-line interface_sentence_2

Such access was primarily provided to users by computer terminals starting in the mid-1960s, and continued to be used throughout the 1970s and 1980s on VAX/VMS, Unix systems and personal computer systems including DOS, CP/M and Apple DOS. Command-line interface_sentence_3

Today, many users rely upon graphical user interfaces and menu-driven interactions. Command-line interface_sentence_4

However, some programming and maintenance tasks may not have a graphical user interface and may still use a command line. Command-line interface_sentence_5

Alternatives to the command line interface include text-based user interface menus (for example, IBM AIX SMIT), keyboard shortcuts, and various desktop metaphors centered on the pointer (usually controlled with a mouse). Command-line interface_sentence_6

Examples of this include the Microsoft Windows, DOS Shell, and Mouse Systems PowerPanel. Command-line interface_sentence_7

Command-line interfaces are often implemented in terminal devices that are also capable of screen-oriented text-based user interfaces that use cursor addressing to place symbols on a display screen. Command-line interface_sentence_8

Programs with command-line interfaces are generally easier to automate via scripting. Command-line interface_sentence_9

Many software systems implement command-line interfaces for control and operation. Command-line interface_sentence_10

This includes programming environments and utility programs. Command-line interface_sentence_11

Comparison to graphical user interfaces Command-line interface_section_0

Compared with a graphical user interface, a command-line interface requires fewer system resources to implement. Command-line interface_sentence_12

Since options to commands are given in a few characters in each command line, an experienced user may often find the options easier to access. Command-line interface_sentence_13

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. Command-line interface_sentence_14

A command-line history can be kept, allowing review or repetition of commands. Command-line interface_sentence_15

A command-line system may require paper or online manuals for the user's reference, although often a "help" option provides a concise review of the options of a command. Command-line interface_sentence_16

The command-line environment may not provide graphical enhancements such as different fonts or extended edit windows found in a GUI. Command-line interface_sentence_17

It may be difficult for a new user to become familiar with all the commands and options available, compared with the icons and drop-down menus of a graphical user interface, without repeated reference to manuals. Command-line interface_sentence_18

Types Command-line interface_section_1

Operating system command-line interfaces Command-line interface_section_2

Operating system (OS) command-line interfaces are usually distinct programs supplied with the operating system. Command-line interface_sentence_19

A program that implements such a text interface is often called a command-line interpreter, command processor or shell. Command-line interface_sentence_20

Examples of command-line interpreters include DEC's DIGITAL Command Language (DCL) in OpenVMS and RSX-11, the various Unix shells (sh, ksh, csh, tcsh, zsh, bash, etc.), CP/M's CCP, DOS' COMMAND.COM, as well as the OS/2 and the Windows CMD.EXE programs, the latter groups being based heavily on DEC's RSX-11 and RSTS CLIs. Command-line interface_sentence_21

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. Command-line interface_sentence_22

Although the term 'shell' is often used to describe a command-line interpreter, strictly speaking, a 'shell' can be any program that constitutes the user-interface, including fully graphically oriented ones. Command-line interface_sentence_23

For example, the default Windows GUI is a shell program named EXPLORER.EXE, as defined in the SHELL=EXPLORER.EXE line in the WIN.INI configuration file. Command-line interface_sentence_24

These programs are shells, but not CLIs. Command-line interface_sentence_25

Application command-line interfaces Command-line interface_section_3

Application programs (as opposed to operating systems) may also have command-line interfaces. Command-line interface_sentence_26

An application program may support none, any, or all of these three major types of command-line interface mechanisms: Command-line interface_sentence_27

Command-line interface_unordered_list_0

  • Parameters: Most operating systems support a means to pass additional information to a program when it is launched. When a program is launched from an OS command-line shell, additional text provided along with the program name is passed to the launched program.Command-line interface_item_0_0
  • Interactive command-line sessions: After launch, a program may provide an operator with an independent means to enter commands in the form of text.Command-line interface_item_0_1
  • Inter-process communication: Most operating systems support means of inter-process communication (for example, standard streams or named pipes). Command lines from client processes may be redirected to a CLI program by one of these methods.Command-line interface_item_0_2

Some applications support only a CLI, presenting a CLI prompt to the user and acting upon command lines as they are entered. Command-line interface_sentence_28

Other programs support both a CLI and a GUI. Command-line interface_sentence_29

In some cases, a GUI is simply a wrapper around a separate CLI . Command-line interface_sentence_30

In other cases, a program may provide a CLI as an optional alternative to its GUI. Command-line interface_sentence_31

CLIs and GUIs often support different functionality. Command-line interface_sentence_32

For example, all features of MATLAB, a numerical analysis computer program, are available via the CLI, whereas the MATLAB GUI exposes only a subset of features. Command-line interface_sentence_33

The early Sierra games, such as the first three King's Quest games (1984–1986), used commands from an internal command line to move the character around in the graphic window. Command-line interface_sentence_34

History Command-line interface_section_4

The command-line interface evolved from a form of dialog once conducted by humans over teleprinter (TTY) machines, in which human operators remotely exchanged information, usually one line of text at a time. Command-line interface_sentence_35

Early computer systems often used teleprinter machines as the means of interaction with a human operator. Command-line interface_sentence_36

The computer became one end of the human-to-human teleprinter model. Command-line interface_sentence_37

So instead of a human communicating with another human over a teleprinter, a human communicated with a computer. Command-line interface_sentence_38

The mechanical teleprinter was replaced by a "glass tty", a keyboard and screen emulating the teleprinter. Command-line interface_sentence_39

"Smart" terminals permitted additional functions, such as cursor movement over the entire screen, or local editing of data on the terminal for transmission to the computer. Command-line interface_sentence_40

As the microcomputer revolution replaced the traditional – minicomputer + terminals – time sharing architecture, hardware terminals were replaced by terminal emulators — PC software that interpreted terminal signals sent through the PC's serial ports. Command-line interface_sentence_41

These were typically used to interface an organization's new PC's with their existing mini- or mainframe computers, or to connect PC to PC. Command-line interface_sentence_42

Some of these PCs were running Bulletin Board System software. Command-line interface_sentence_43

Early operating system CLIs were implemented as part of resident monitor programs, and could not easily be replaced. Command-line interface_sentence_44

The first implementation of the shell as a replaceable component was part of the Multics time-sharing operating system. Command-line interface_sentence_45

In 1964, MIT Computation Center staff member Louis Pouzin developed the RUNCOM tool for executing command scripts while allowing argument substitution. Command-line interface_sentence_46

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. Command-line interface_sentence_47

Pouzin returned to his native France in 1965, and the first Multics shell was developed by Glenda Schroeder. Command-line interface_sentence_48

The first Unix shell, the V6 shell, was developed by Ken Thompson in 1971 at Bell Labs and was modeled after Schroeder's Multics shell. Command-line interface_sentence_49

The Bourne shell was introduced in 1977 as a replacement for the V6 shell. Command-line interface_sentence_50

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. Command-line interface_sentence_51

The Bourne shell led to the development of the KornShell (ksh), Almquist shell (ash), and the popular Bourne-again shell (or Bash). Command-line interface_sentence_52

Early microcomputers themselves were based on a command-line interface such as CP/M, DOS or AppleSoft BASIC. Command-line interface_sentence_53

During the 1980s and 1990s, the introduction of the Apple Macintosh and of Microsoft Windows on PCs saw the command line interface as the primary user interface replaced by the Graphical User Interface. Command-line interface_sentence_54

The command line remained available as an alternative user interface, often used by system administrators and other advanced users for system administration, computer programming and batch processing. Command-line interface_sentence_55

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. Command-line interface_sentence_56

MinGW and Cygwin are open-source packages for Windows that offer a Unix-like CLI. Command-line interface_sentence_57

Microsoft provides MKS Inc.'s ksh implementation MKS Korn shell for Windows through their Services for UNIX add-on. Command-line interface_sentence_58

Since 2001, the Macintosh operating system macOS has been based on a Unix-like operating system called Darwin. Command-line interface_sentence_59

On these computers, users can access a Unix-like command-line interface by running the terminal emulator program called Terminal, which is found in the Utilities sub-folder of the Applications folder, or by remotely logging into the machine using ssh. Command-line interface_sentence_60

Z shell is the default shell for macOS; bash, tcsh, and the KornShell are also provided. Command-line interface_sentence_61

Before macOS Catalina, bash was the default. Command-line interface_sentence_62

Usage Command-line interface_section_5

Anatomy of a shell CLI Command-line interface_section_6

Command-line interpreter Command-line interface_section_7

See also: List of command-line interpreters Command-line interface_sentence_63

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 or another kind of data stream. Command-line interface_sentence_64

The context of interpretation is usually one of a given operating system or programming language. Command-line interface_sentence_65

Command-line interpreters allow users to issue various commands in a very efficient (and often terse) way. Command-line interface_sentence_66

This requires the user to know the names of the commands and their parameters, and the syntax of the language that is interpreted. Command-line interface_sentence_67

The Unix #! Command-line interface_sentence_68

mechanism and OS/2 EXTPROC command facilitate the passing of batch files to external processors. Command-line interface_sentence_69

One can use these mechanisms to write specific command processors for dedicated uses, and process external data files which reside in batch files. Command-line interface_sentence_70

Many graphical interfaces, such as the OS/2 Presentation Manager and early versions of Microsoft Windows use command-lines to call helper programs to open documents and programs. Command-line interface_sentence_71

The commands are stored in the graphical shell or in files like the registry or the OS/2 OS2USER.INI file. Command-line interface_sentence_72

Early history Command-line interface_section_8

The earliest computers did not support interactive input/output devices, often relying on sense switches and lights to communicate with the computer operator. Command-line interface_sentence_73

This was adequate for batch systems that ran one program at a time, often with the programmer acting as operator. Command-line interface_sentence_74

This also had the advantage of low overhead, since lights and switches could be tested and set with one machine instruction. Command-line interface_sentence_75

Later a single system console was added to allow the operator to communicate with the system. Command-line interface_sentence_76

From the 1960s onwards, user interaction with computers was primarily by means of command-line interfaces, initially on machines like the Teletype Model 33 ASR, but then on early CRT-based computer terminals such as the VT52. Command-line interface_sentence_77

All of these devices were purely text based, with no ability to display graphic or pictures. Command-line interface_sentence_78

For business application programs, text-based menus were used, but for more general interaction the command line was the interface. Command-line interface_sentence_79

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). Command-line interface_sentence_80

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. Command-line interface_sentence_81

Unix also had the capability to save and re-run strings of commands as "shell scripts" which acted like custom commands. Command-line interface_sentence_82

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. Command-line interface_sentence_83

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. Command-line interface_sentence_84

The command-line was first seriously challenged by the PARC GUI approach used in the 1983 Apple Lisa and the 1984 Apple Macintosh. Command-line interface_sentence_85

A few computer users used GUIs such as GEOS and Windows 3.1 but the majority of IBM PC users did not replace their COMMAND.COM shell with a GUI until Windows 95 was released in 1995. Command-line interface_sentence_86

Modern usage as an operating system shell Command-line interface_section_9

While most non-expert computer users now use a GUI almost exclusively, more advanced users have access to powerful command-line environments: Command-line interface_sentence_87

Command-line interface_unordered_list_1

  • The default VAX/VMS command shell, using the DCL language, has been ported to Windows systems at least three times, including PC-DCL and Acceler8 DCL Lite. Unix command shells have been ported to VMS and DOS/Windows 95 and Windows NT types of operating systems. COMMAND.COM and Windows NT cmd.exe have been ported to Windows CE and presumably works on Microsoft Windows NT Embedded 4.0Command-line interface_item_1_3
  • Windows Resource Kit and Windows Services for Unix include Korn and the Bourne shells along with a Perl interpreter (Services of Unix contains Active State ActivePerl in later versions and Interix for versions 1 and 2 and a shell compiled by Microsoft)Command-line interface_item_1_4
  • IBM OS/2 (and derivatives such as eComStation and ArcaOS) has the cmd.exe processor. This copies the COMMAND.COM commands, with extensions to REXX.Command-line interface_item_1_5
  • cmd.exe and COMMAND.COM are part of the Windows NT stream of operating systems.Command-line interface_item_1_6
  • Yet another cmd.exe is a stripped-down shell for Windows CE 3.0.Command-line interface_item_1_7
  • An MS-DOS type interpreter called PocketDOS has been ported to Windows CE machines; the most recent release is almost identical to MS-DOS 6.22 and can also run Windows 1, 2, and 3.0, QBasic and other development tools, 4NT and 4DOS. The latest release includes several shells, namely MS-DOS 6.22, PC DOS 7, DR DOS 3.xx, and others.Command-line interface_item_1_8
  • Windows users have a CLI environment named Windows Command Prompt, which might use the CScript interface to alternate programs. PowerShell provides a command-line interface, but its applets are not written in Shell script. Implementations of the Unix shell are also available as part of the POSIX sub-system, Cygwin, MKS Toolkit, UWIN, Hamilton C shell and other software packages. Available shells for these interoperability tools include csh, ksh, sh, bash, rsh, tclsh and less commonly zsh, pshCommand-line interface_item_1_9
  • COMMAND.COM (4DOS), Windows NT cmd.exe (4NT, TCC), and OS/2 cmd.exe (4OS2) and others based on them are enhanced shells which can be a replacement for the native shell or a means of enhancement of the default shell.Command-line interface_item_1_10
  • Implementations of PHP have a shell for interactive use called php-cli.Command-line interface_item_1_11
  • Standard Tcl/Tk has two interactive shells, Tclsh and Wish, the latter being the GUI version.Command-line interface_item_1_12
  • Python, Ruby, Lua, XLNT, and other interpreters also have command shells for interactive use.Command-line interface_item_1_13
  • FreeBSD uses tcsh as its default interactive shell for the superuser, and ash as default scripting shell.Command-line interface_item_1_14
  • Apple macOS and many Linux distributions have the Bash implementation of the Unix shell. Early versions of macOS used tcsh as the default shell.Command-line interface_item_1_15
  • Embedded Linux (and other embedded Unix-like) devices often use the Ash implementation of the Unix shell, as part of Busybox.Command-line interface_item_1_16
  • Android uses the mksh shell, which replaces a shell derived from ash that was used in older Android versions, supplemented with commands from the separate toolbox binary.Command-line interface_item_1_17
  • Routers with Cisco IOS, Junos and many others are commonly configured from the command line.Command-line interface_item_1_18

Scripting Command-line interface_section_10

Most command-line interpreters support scripting, to various extents. Command-line interface_sentence_88

(They are, after all, interpreters of an interpreted programming language, albeit in many cases the language is unique to the particular command-line interpreter.) Command-line interface_sentence_89

They will interpret scripts (variously termed shell scripts or ) written in the language that they interpret. Command-line interface_sentence_90

Some command-line interpreters also incorporate the interpreter engines of other languages, such as REXX, in addition to their own, allowing the executing of scripts, in those languages, directly within the command-line interpreter itself. Command-line interface_sentence_91

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. Command-line interface_sentence_92

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

In other cases, such a command interpreter can present a highly customised user interface employing the user interface and input/output facilities of the language. Command-line interface_sentence_94

Other command-line interfaces Command-line interface_section_11

The command line provides an interface between programs as well as the user. Command-line interface_sentence_95

In this sense, a command line is an alternative to a dialog box. Command-line interface_sentence_96

Editors and databases present a command line, in which alternate command processors might run. Command-line interface_sentence_97

On the other hand, one might have options on the command line, which opens a dialog box. Command-line interface_sentence_98

The latest version of 'Take Command' has this feature. Command-line interface_sentence_99

DBase used a dialog box to construct command lines, which could be further edited before use. Command-line interface_sentence_100

Programs like BASIC, diskpart, Edlin, and QBASIC all provide command-line interfaces, some of which use the system shell. Command-line interface_sentence_101

Basic is modeled on the default interface for 8-bit Intel computers. Command-line interface_sentence_102

Calculators can be run as command-line or dialog interfaces. Command-line interface_sentence_103

Emacs provides a command-line interface in the form of its minibuffer. Command-line interface_sentence_104

Commands and arguments can be entered using Emacs standard text editing support, and output is displayed in another buffer. Command-line interface_sentence_105

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. Command-line interface_sentence_106

One controls the character by typing commands like 'get ring' or 'look'. Command-line interface_sentence_107

The program returns a text which describes how the character sees it, or makes the action happen. Command-line interface_sentence_108

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. Command-line interface_sentence_109

The most notable of these interfaces is the standard streams interface, which allows the output of one command to be passed to the input of another. Command-line interface_sentence_110

Text files can serve either purpose as well. Command-line interface_sentence_111

This provides the interfaces of piping, filters and redirection. Command-line interface_sentence_112

Under Unix, too, so the normal type of file for the shell used for stdin,stdout and stderr is a tty device file. Command-line interface_sentence_113

Another command-line interface allows a shell program to launch helper programs, either to launch documents or start a program. Command-line interface_sentence_114

The command is processed internally by the shell, and then passed on to another program to launch the document. Command-line interface_sentence_115

The graphical interface of Windows and OS/2 rely heavily on command-lines passed through to other programs – console or graphical, which then usually process the command line without presenting a user-console. Command-line interface_sentence_116

Programs like the OS/2 E editor and some other IBM editors, can process command-lines normally meant for the shell, the output being placed directly in the document window. Command-line interface_sentence_117

A web browser's URL input field can be used as a command line. Command-line interface_sentence_118

It can be used to "launch" web apps, access browser configuration, as well as perform a search. Command-line interface_sentence_119

Google, which has been called "the command line of the internet" will perform a domain-specific search when it detects search parameters in a known format. Command-line interface_sentence_120

This functionality is present whether the search is triggered from a browser field or on Google's website. Command-line interface_sentence_121

Many video games on the PC feature a command line interface often referred to as a console. Command-line interface_sentence_122

It is typically used by the game developers during development and by mod developers for debugging purposes as well as for cheating or skipping parts of the game. Command-line interface_sentence_123

See also Command-line interface_section_12

Command-line interface_unordered_list_2


Credits to the contents of this page go to the authors of the corresponding Wikipedia page: en.wikipedia.org/wiki/Command-line interface.