Microsoft Store
 

Command line interface


 

A command line interface or CLI is a method of interacting with a computer by giving it lines of textual commands (that is, a sequence of characters) either from keyboard input or from a script. They were originally developed for interfacing with computers over teletype machines in the 1950s. It is occasionally also referred to as a CLUE, for Command Line User Environment. Some argue that the CLI is not actually a user interface at all, but a programming language, entered one line at a time, and has very little utility for users compared to developers. Indeed, command lines are most often used in scientific or engineering environments for programming.

Advantages of a command line interface

Even though new users seem to learn GUIs more quickly to perform common operations, well-designed CLIs have several advantages:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

  • Skilled users are able to use a command line faster than a GUI for many tasks. This advantage is magnified by tab completion and by the fact that programs intended to be run from the command line are often given very short names.
  • Options and operations are often invokable in a consistent form, one "level" away from the basic command. With most GUIs, the available operations and options may appear on different menus with differing usage patterns. They may be separated on several different menu levels as well. In either case, different applications (or utilities) may have different patterns; if so there is little advantage in either approach. Both are likely to annoy users.
  • All options and operations are controlled in more or less the same way. The "more or less" in this case is a common accusation against CLIs: it should be no more difficult to understand and perform a rare operation than a common one, but in practice it may require learning previously unencountered syntax. However, few GUIs offer even comparable access to their entire range of available options.
  • CLIs can often double as scripting programming languages and can perform operations in a batch processing mode without user interaction. That means that once an operation is analyzed and understood, a "script" implementing that understanding can be written and saved. The operation can thereafter be carried out with no further analysis and design effort. With GUIs, users must start over at the beginning every time, as GUI scripting (if available at all) is almost always more limited ? although macros can sometimes be used in a similar way. Simple commands do not even need an actual script, as the completed command can usually be assigned a name (an "alias") and executed simply by typing that name into the CLI.
  • The keyboard can be a more precise input device than the mouse. Even people who are not accomplished typists could accurately enter the sequence "abcde" twenty times in a row without error, while it is difficult to exactly control or repeat a mouse movement even twice in a row. Moreover, typing errors can usually be corrected with a "backspace" or "delete" key before the command is submitted for processing, while the ability to correct or "undo" mouse errors is generally left to the idiosyncrasies of whatever program you may be using. Finally, some command languages allow you to go back to previous commands, correct or improve them, and resubmit them. Thus you may find it easier to reliably control your computer with a keyboard.
  • Command-line interfaces require much less network bandwidth to run remotely; while a CLI may run acceptably over a 9600 baud serial port, a GUI consists of much more data. Similarly, modern CLIs require much less in the way of system resources, such as processor time and memory, to run than modern GUIs.
  • GUI advocates claim the support of usability researchers, arguing that among other things the GUI gives the users symbols with which they can interact more intuitively, and that users should not be expected to know how things work. However, this layer of abstraction can also hinder usability. Those whose profession includes providing technical support to such users often observe that the users' frustrations and lost productivity are directly caused by their unwillingness or inability to understand how their chosen tool works. Because the GUI masks what's really going on internally, it misleads the users into attempting to manipulate a symbolic representation of an object rather than the actual object. When the visual metaphor is not perfectly aligned with the reality, confusion results. A typical CLI puts you in direct contact with whatever you are trying to manipulate. To put it in usability terms, when you have a GUI between you and the internals, you can't really see what's going on.
  • Some GUIs, in the name of "usability", try to "learn" what programs are used most or which documents were opened recently, allowing the GUI to offer customized menus tailored to each situation. Unfortunately, a side effect of this is that the menus are constantly changing, forcing the user into a tightly interactive relationship with the computer which requires visually scanning for the desired icon or file name to trigger recognition memory, which can lead to mode errors. Because many CLIs are designed for scripting, they do not change over time unless deliberately changed (see modeless). This means using recall memory to complete a frequently-repeated task is more likely to work. One can quickly issue repetitively-used directives to the computer without interrupting their train of thought to constantly scan the screen and react to the computer's changing state.
  • Typeahead, the ability to continue issuing commands while your computer is processing some lengthy step, is much more likely to produce the intended result than the GUI equivalent, "clickahead". With a GUI, you constantly have to stop and wait for your computer to catch up.