GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing en.wikipedia.org — Command-line interface - Wikipedia (Redirected from Compiler flag)
A command-line interface (CLI), also known as a command-line shell,[1][2] is a means of interacting with software via commands, each formatted as a line of text. The concept of interacting with a computer via text evolved over two decades, transitioning from hardware to sophisticated software. Before the CLI, computers were programmed using physical switches or punched cards.[3] The shift toward a command-style interaction began with the use of teleprinters or teletypes. Early systems such as the Whirlwind I (1951) at the Massachusetts Institute of Technology (MIT) began using typewriter-like inputs to give users direct control, departing from batch processing, in which a user submitted a stack of cards to an operator and received the results hours later.[4] Devices such as the Teletype Model 33, introduced in 1963, allowed operators to type a command and receive a printed response from the computer.[5] The command-line interpreter emerged when computers became powerful enough to handle multiple users at once, a mode of operation known as time-sharing. The Compatible Time-Sharing System (CTSS), developed in 1961 at MIT, introduced the first true command-line interpreter. For the first time, a user could type a command such as Many CLIs enable software automation, since commands can be stored in a script file that can be run repeatedly. A script allows its contained commands to be executed as a group (as a single program). Alternatives to a CLI include the following:
Comparison to graphical user interfacesCompared with a graphical user interface, a command-line interface requires fewer system resources to implement. Since command options can be entered in only a few characters on each command line, an experienced user often finds these options easier to access. Automation of repetitive tasks is simplified by line editing and history mechanisms for storing recently or frequently used sequences, allowing the review and repetition of commands; this capability may extend to a scripting language that can accept parameters and variable options. A command-line system may require online or paper manuals for a user's reference, although often a help option provides a concise review of the options for a command. The command-line environment may not provide graphical enhancements, such as the different fonts or extended edit windows found in a GUI. Compared with the icons and drop-down menus of a GUI, a command line may make it harder for a new user to become familiar with all available commands and options without referring to manuals. TypesOperating system command-line interfacesOperating system (OS) command-line interfaces are usually distinct programs supplied with an OS. A program that implements such a text interface is often called a command-line interpreter, command processor, or shell. Examples of command-line interpreters include the following:
Under most operating systems, the default shell program can be replaced with alternatives; examples include 4DOS for DOS, 4OS2 for OS/2, and 4NT / Take Command for Windows. The term shell is often used to describe a command-line interpreter. Strictly speaking, a shell is a command interpreter and processor, and by extension a program that provides an interface—either a user interface (UI; command-line interface, GUI, etc.) or a programming interface—to a command interpreter and processor, as well as to the broad capabilities of the operating system. For example, the default Windows GUI is a shell GUI named explorer.exe, as defined on the Application command-line interfacesApplication programs (as opposed to operating systems) may also have command-line interfaces. An application program may support none, some, or all of the following three major types of CLI mechanisms:
Some applications support a CLI, presenting their own prompt to a user and accepting command lines. Other programs support both a CLI and a GUI. In some cases, a GUI is simply a wrapper around a separate CLI executable file. In other cases, a program may provide a CLI as an optional alternative to its GUI. CLIs and GUIs often support different functionality. For example, all features of MATLAB, a computer program for numerical analysis, are available via the CLI, whereas the MATLAB GUI exposes only a subset. In the video game Colossal Cave Adventure from 1976, the player uses a CLI to enter one or two words in order to explore a cave system. HistoryThe command-line interface evolved from a form of communication used by people via teleprinter or teletype (TTY) machines. Sometimes these communications involved sending an order or a confirmation using telex. Early computer systems often used a teleprinter to interact with an operator. The mechanical teleprinter was replaced by a "glass TTY", a keyboard and a screen emulating the teleprinter. "Smart" terminals permitted additional functions, such as cursor movement over the entire screen, or local editing of data on the terminal for transmission to a computer. As the microcomputer revolution replaced the traditional time-sharing architecture—a minicomputer with terminals—hardware terminals were replaced by terminal emulators: personal computer (PC) software that interpreted terminal signals sent through the PC's serial ports. These emulators were typically used to interface an organization's new PCs with its existing mini- or mainframe computers, or to connect one PC to another PC. Some of these PCs ran software for bulletin board systems. Early operating system CLIs were implemented as part of resident monitor programs, and these CLIs were difficult to replace. The first implementation of a shell as a replaceable component was part of the Multics time-sharing operating system.[6] In 1964, Louis Pouzin—a staff member of the MIT Computation Center—developed the RUNCOM tool for executing command scripts while allowing argument substitution.[7] Pouzin coined the term shell to describe the technique of using commands like a programming language, and he wrote a paper on how to implement the idea in the Multics operating system.[8] Pouzin returned to his native France in 1965, and the first Multics shell was developed by software engineer Glenda Schroeder.[7] The first Unix shell, the V6 shell, was developed by computer scientist Ken Thompson in 1971 at Bell Labs, and it was modeled on Schroeder's Multics shell.[9][10] The Bourne shell was introduced in 1977 as a replacement for the V6 shell. Although the Bourne shell is used as an interactive command interpreter, it was also intended as a scripting language and contains most features that are commonly seen as producing structured programs. The Bourne shell led to the development of the KornShell (ksh), the Almquist shell (ash), and the popular Bourne-again shell (or Bash).[10] Early microcomputers were based on a command-line interface such as CP/M, DOS, or Applesoft BASIC. During the 1980s and 1990s, with the introduction of the Apple Macintosh and Microsoft Windows on PCs, the command-line interface as the primary UI was replaced by the GUI.[11] The command line remained available as an alternative UI, often used by system administrators and other advanced users for system administration, computer programming, and batch processing. In November 2006, Microsoft released version 1.0 of Windows PowerShell (formerly codenamed Monad), which combined features of traditional Unix shells with the proprietary 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 its Windows Services for UNIX add-on. Since 2001, the Macintosh operating system macOS has been based on a Unix-like operating system called Darwin.[12] On Macintosh computers, users can access a Unix-like command-line interface by running the terminal emulator program called Terminal, which is found in the Utilities subfolder of the Applications folder, or by remotely logging into the machine using Secure Shell (SSH). Z shell is the default shell for macOS; Bash, tcsh, and the KornShell are also provided. Before the version of macOS known as Catalina, Bash was the default shell. UsageA CLI is employed whenever a large vocabulary of commands or queries, coupled with a wide (or arbitrary) range of options, can be entered more quickly as text than with a pure GUI. This is typically the case with OS command shells. CLIs are also used by systems with insufficient resources to support a GUI. Some computer language systems—such as Python,[13] Forth, LISP, Rexx, and many dialects of BASIC—provide an interactive command-line mode (generally a read–eval–print loop environment) 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 PC users. CLIs are also popular among users with visual disabilities, because commands and responses can be displayed using refreshable braille displays. Anatomy of a shell CLI
The general pattern of a command line is as follows:[14][15] prompt command param1 param2 param3 … paramN
In this command-line format, the delimiters between command-line elements are whitespace characters, and the end-of-line delimiter is the newline character. This convention is widely used but not universal. A command-line interface can generally be considered to consist of syntax and semantics. The syntax of a CLI is the grammar that all commands must follow. In operating systems, DOS and Unix each define their own set of rules that all commands must follow. In embedded systems, each vendor—such as Nortel, Juniper Networks, and Cisco Systems—defines its own proprietary set of rules. These rules also dictate how a user navigates through the system of commands. The semantics of a CLI define what sort of operations are possible, on what sort of data these operations can be performed, and how the grammar represents these operations and data—in other words, the symbolic meaning in the syntax. Two different CLIs may agree on either syntax or semantics; however, only when these CLIs agree on both can they be considered similar enough that users can work with both CLIs without needing to learn new syntax or semantics, and that scripts can be reused. A simple CLI first displays a prompt, then accepts a command line typed by the user and terminated by the Enter key, and finally executes the specified command and provides a textual display of the results or error messages. Advanced CLIs validate, interpret, and parameter-expand a command line before executing the specified command, and they optionally capture or redirect the command's output. Unlike a button or a menu item in a GUI, a command line is typically self-documenting,[19] stating exactly what action the user would like to be performed. In addition, command lines usually include many defaults that can be changed to customize 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 example, compile a program, install it, and then run it—creating a single entity, called a command procedure or script, which can be treated as a command. With these advantages, a user needs to figure out a complex command or series of commands only once, because the commands can be saved for reuse. The commands given to a CLI shell are often in one of the following forms:
In these forms, doSomething is, in effect, a verb; how is an adverb (for example, should the command be executed verbosely or quietly); and toFiles is an object or objects (typically one or more files) on which the command should act. The CLI and resource protectionOn some systems, such as Unix-like systems or Windows, a user can change the set of available commands by modifying which paths appear in the PATH environment variable or its equivalent. On Unix-like systems, the file containing the executable or script for a command also must be given execute permission. The directories in the A command line allows a person to restrict the available commands, for example, by blocking access to advanced internal commands. The Bourne shell and workalikes (software with similar functionality) such as Bash can be run as a restricted shell. Among other effects, this restriction prohibits the user from modifying the Some CLIs, such as those in network routers, have a hierarchy of modes, with a different set of commands supported in each mode. Each set of commands is grouped by association with security, system, interface, and so on. In these systems, a user might traverse a series of submodes. For example, if the CLI has two modes called interface and system, the user might use the command In IBM's MVS operating systems, the Authorized Program Facility (APF) allows certain authorized programs to run with enhanced privileges, analogous to the superuser account UID(0) in Unix-like systems. As another example, a set of extensions to IBM's Time Sharing Option environment (TSO/E) supports calling authorized commands, but only those commands, programs and services in an installation-controlled list. Command prompt"Command prompt" redirects here. For the Windows component named Command Prompt, see cmd.exe.
A command prompt (or prompt) is a sequence of (one or more) characters used in a command-line interface to indicate readiness to accept commands. It literally promptss the user to take action. A prompt usually ends with one of the characters On many Unix and derivative systems, a prompt commonly ends in a End users can often modify prompts. Depending on the environment, these prompts may include colors, special characters, and other elements. Such elements may be variables and functions for the current time, user, shell number, or working directory. These modifications have several goals—for example, 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. On some systems, special tokens in the prompt's definition can be used to cause external programs to be called by the command-line interpreter while displaying the prompt. In DOS's Many Unix systems feature the [time] user@host: work_dir $ can be set by issuing the command export PS1='[\t] \u@\H: \W $' In zsh, the In RISC OS, the command prompt is a In IBM's TSO environment, the command prompt is referred to as the READY prompt, after the word Some shells, such as Bash, zsh, and PowerShell, allow the use of prompt systems that display much more information in the command prompt; such information may include the type of remote connection, the state of machine sensors, or additional information about a version control system. These shells often use several ANSI colors, Unicode characters, and advanced shell features to create a colorful display. Example of prompt system displays Arguments
A command-line argument or parameter is an item of information provided to a program when it is started.[26] A program can have many command-line arguments that identify sources or destinations of information, or that alter the operation of the program. When a command processor is active, a program is typically invoked by typing its name followed by command-line arguments (if any). For example, in Unix and Unix-like environments, a command-line argument might look like this: rm file.s
Some programming languages—such as C, C++, and Java—allow a program to interpret the command-line arguments by handling them as string parameters in the program's main function.[27][28] Other languages, such as Python, expose an OS-specific application programming interface (API; connection between computers or programs) through the language's In Unix-like operating systems, a single Command-line optionsA command-line option or simply option (also known as a flag or switch) modifies the operation of a command; the effect is determined by the command's program. Options follow the command name on the command line, separated by characters such as commas or spaces. Separators are not always required, as in the command lines The format of options varies widely between operating systems. In most cases, the syntax is by convention rather than being an OS requirement. The entire command line is simply a string passed to a program, which can process this string however the programmer would like, provided that the interpreter can determine where the command name ends and the command's arguments and options begin. A few representative samples of command-line options, most related to listing files in a directory, illustrate some conventions:
Command-line argument parsing is used to analyze the arguments of a program, and such functionality is available in various languages. For example, the getopt() function for parsing arguments is available in the C POSIX library. Abbreviating commandsSee also: Tab completion
In the Multics operating system, command-line options and subsystem keywords may be abbreviated. This idea appears to derive from the PL/I programming language, with its shortened keywords (e.g., In some other systems, abbreviations are automatic, such as accepting enough of the first characters of a command name to identify it uniquely (e.g., Option conventions in DOS, Windows, OS/2In DOS, OS/2, and Windows, different programs called from their
In DOS, OS/2, and Windows, the forward slash ( However, many programs are hardwired to use only the Option conventions in Unix-like systems
In Unix-like systems, an ASCII hyphen-minus character begins options; the new convention, also used by the GNU software collection, is to use two hyphens followed by a word (e.g., Two hyphen-minus characters with no letters ( Unix command names, arguments, and options are case-sensitive (except in a few cases, primarily when popular commands from other operating systems have been ported to Unix). Option conventions in other systemsFlexOS, 4680 OS, and 4690 OS use the The Conversational Monitor System (CMS) uses a single left parenthesis to separate options at the end of a command from the other arguments. For example, in the following command, the options indicate that the target file should be replaced if it exists, and the date and time of the source file should be retained in the copy: Operator commands in OS/360 use a comma-separated list of positional and keyword parameters; only the documented command and keyword abbreviations are valid. Keyword values are separated from keywords by equal signs. TSO commands use a space-separated list of positional and keyword parameters; keywords may be truncated to any unique substring. Only the documented command abbreviations are valid. Keyword values are placed inside parentheses. Data General's CLI under its RDOS, AOS, and other operating systems—as well as the version of the CLI that came with the company's Business Basic—uses only the Built-in usage helpSee also: help (command)
One of the criticisms of a CLI is the lack of cues to the user as to the available actions.[34] In contrast, GUIs usually inform the user of available actions with menus, icons, or other visual cues.[35] To overcome this limitation, many CLI programs display a usage message, typically when invoked with no arguments or one of However, entering a program name without parameters in the hope that it will display usage help can be hazardous, as programs and scripts for which command-line arguments are optional will execute without further notice. Although desirable at least for the help parameter, programs may not support all option lead-in characters exemplified above. Under DOS, where the default command-line option character can be changed from In some cases, different levels of help can be selected for a program. Some programs supporting this allow giving a verbosity level as an optional argument to the help parameter (as in Depending on the program, additional or more specific help on accepted parameters is sometimes available by either providing the parameter in question as an argument to the help parameter or vice versa (as in In a similar fashion to the help parameter, but much less common, some programs provide additional information about themselves (like mode, status, version, author, license or contact information) when invoked with an about parameter such as Since the If more detailed help is necessary than provided by a program's built-in internal help, many systems support a dedicated external In the DR-DOS family, typing Command description syntaxBuilt-in usage help and man pages commonly employ a small syntax to describe the valid command form:[40][41][42][nb 2]
Notice that these characters have different meanings than when used directly in the shell. Angle brackets may be omitted when confusing the parameter name with a literal string is not likely. The space characterIn many areas of computing, but particularly in the command line, the space character can cause problems as it has two distinct and incompatible functions: as part of a command or parameter, or as a parameter or name separator. Ambiguity can be prevented either by prohibiting embedded spaces in file and directory names in the first place (for example, by substituting them with underscores
is ambiguous (is program name part of the program name, or two parameters?); however
and
are not ambiguous. Unix-like operating systems minimize the use of embedded spaces to minimize the need for quotes. In Microsoft Windows, a user often has to use quotes because embedded spaces (such as in directory names) are common. Command-line interpreterSee also: List of command-line interpreters
The term command-line interpreter 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. The context of interpretation is usually that of a given operating system or programming language. Command-line interpreters allow users to issue various commands in a very efficient (and often terse) way. This requires the user to know the names of the commands and their parameters, and the syntax of the language that is interpreted. The Unix 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. The commands are stored in the graphical shell or in files such as the registry or the OS/2 Early historyThe earliest computers did not support interactive input/output devices, often relying on sense switches and lights to communicate with the computer operator. This was adequate for batch systems that ran one program at a time, often with the programmer acting as operator. This also had the advantage of low overhead, since lights and switches could be tested and set with one machine instruction. Later, a single system console was added to allow the operator to communicate with the system. From the 1960s onwards, user interaction with computers was primarily by means of command-line interfaces, initially on machines such as the Teletype Model 33 ASR, but then on early CRT-based computer terminals such as the VT52. All of these devices were purely text-based, with no ability to display graphics or pictures.[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).[44] From the early 1970s, the Unix operating system adapted the concept of a powerful command-line environment, and it introduced the ability to pipe the output of one command as input to another. Unix also had the capability to save and re-run strings of commands as shell scripts that acted like custom commands. 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. The command line was first seriously challenged by the PARC GUI approach used in the 1983 Apple Lisa and the 1984 Apple Macintosh. A few computer users used GUIs such as GEOS and Windows 3.1, but the majority of IBM PC users did not replace their Modern usage as an operating system shellWhile most non-expert computer users now use a GUI almost exclusively, more advanced users have access to powerful command-line environments:
ScriptingMost command-line interpreters support scripting, to various extents. They are, after all, interpreters of an interpreted programming language, albeit in many cases the language is unique to the particular command-line interpreter. They will interpret scripts, variously termed shell scripts or batch files, written in the language that they interpret. Some command-line interpreters also incorporate the interpreter engines of other languages, such as Rexx, in addition to their own, allowing the execution of scripts in those languages directly within the command-line interpreter itself. 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. In other cases, such a command interpreter can present a highly customized UI employing the UI and input/output facilities of the language. Other command-line interfacesThe command line provides an interface between programs as well as the user. In this sense, a command line is an alternative to a dialog box. Editors and databases present a command line, in which alternate command processors might run. On the other hand, a user might have options on the command line, which opens a dialog box. The latest version of "Take Command" has this feature. DBase used a dialog box to construct command lines, which could be further edited before use. Programs such as BASIC, diskpart, Edlin, and QBASIC all provide command-line interfaces, some of which use the system shell. BASIC is modeled on the default interface for 8-bit Intel computers. Calculators can be run as command-line or dialog interfaces. Emacs provides a command-line interface in the form of its minibuffer. Commands and arguments can be entered using Emacs standard text-editing support, and output is displayed in another buffer. There are a number of text mode games, such as Adventure or King's Quest 1-3, which relied on the user typing commands at the bottom of the screen. A player controls the character by typing commands such as 'get ring' or 'look'. The program returns text that describes what the character sees, or it makes the action happen. The text adventure The Hitchhiker's Guide to the Galaxy, a piece of interactive fiction based on Douglas Adams's book of the same name, is a teletype-style command-line game. 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. Text files can serve either purpose as well. This provides the interfaces of piping, filters, and redirection. Under Unix, devices are files too, so the normal type of file for the shell used for stdin, stdout, and stderr is a "tty" device file. Another command-line interface allows a shell program to launch helper programs, either to launch documents or start a program. The command is processed internally by the shell, and then passed on to another program to launch the document. The graphical interface of Windows and OS/2 relies heavily on command lines passed through to other programs —console or graphical, which then usually process the command line without presenting a user console. Programs such as 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. A web browser's URL input field can be used as a command line. It can be used to launch web apps, access browser configuration, as well as perform a search. 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.[55] This functionality is present whether the search is triggered from a browser field or on Google's website. There are JavaScript libraries that help developers write command-line applications for the browser as standalone web apps or as part of bigger applications.[56] An example of such a website is the CLI interface to DuckDuckGo.[57] There are also web-based SSH applications that allow access to a server’s command-line interface from a browser. Many PC video games feature a command-line interface often referred to as a console. 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. See alsoNotes
References
External links
Hidden categories:
| |||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |