HOME

TheInfoList



OR:

In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
, a command is an instruction received via an external interface that directs the behavior of a
computer program A computer program is a sequence or set of instructions in a programming language for a computer to Execution (computing), execute. It is one component of software, which also includes software documentation, documentation and other intangibl ...
. Commonly, commands are sent to a program via a
command-line interface A command-line interface (CLI) is a means of interacting with software via command (computing), commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user ...
, a script, a
network protocol A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any variation of a physical quantity. The protocol defines the rules, syntax, semantics, and synchronization of ...
, or as an event triggered in a
graphical user interface A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
. Many commands support arguments to specify input and to modify default behavior. Terminology and syntax varies but there are notable common approaches. Typically, an option or a flag is a name (without
whitespace White space or whitespace may refer to: Technology * Whitespace characters, characters in computing that represent horizontal or vertical space * White spaces (radio), allocated but locally unused radio frequencies * TV White Space Database, a m ...
) with a prefix such as
dash The dash is a punctuation mark consisting of a long horizontal line. It is similar in appearance to the hyphen but is longer and sometimes higher from the baseline. The most common versions are the endash , generally longer than the hyphen ...
or
slash Slash may refer to: * Slash (punctuation), the "/" character Arts and entertainment Fictional characters * Slash (Marvel Comics) * Slash (''Teenage Mutant Ninja Turtles'') Music * Harry Slash & The Slashtones, an American rock band * Nash th ...
that modifies default behavior. An option might have a required value that follows it. Typically, flag refers to an option that does not have a following value. A parameter is an argument that specifies input to the command and its meaning is based on its position in the command line relative to other parameters; generally ignoring options. A parameter can specify anything, but often it specifies a file by
name A name is a term used for identification by an external observer. They can identify a class or category of things, or a single thing, either uniquely, or within a given context. The entity identified by a name is called its referent. A person ...
or
path A path is a route for physical travel – see Trail. Path or PATH may also refer to: Physical paths of different types * Bicycle path * Bridle path, used by people on horseback * Course (navigation), the intended path of a vehicle * Desir ...
. The term ''command'' is sometimes also used for internal program instructions, but often other terms are more appropriate such as statement, expression, function, or conditional. For example, printing a message in Bash is via the ''command''
printf printf is a C standard library function that formats text and writes it to standard output. The function accepts a format c-string argument and a variable number of value arguments that the function serializes per the format string. Mism ...
, while in Python it is via the ''function'' print(). Further, some aspects of adjacent technology are conflated with commands. For example, conditional logic in Bash and Python is called an ''expression'' and ''statements'' in Java.


Examples

A notable context in which commands are prevalent is the
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
shell Shell may refer to: Architecture and design * Shell (structure), a thin structure ** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses Science Biology * Seashell, a hard outer layer of a marine ani ...
. Commonly, the shell dispatches a command to a program that has a file name matching the first parameter. In a
Unix shell A Unix shell is a Command-line_interface#Command-line_interpreter, command-line interpreter or shell (computing), shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command languag ...
(such as bash and many related variants), the match must be exact including case. The following bash command changes the
working directory In computing, the working directory of a process is a directory of a hierarchical file system, if any, dynamically associated with the process. It is sometimes called the current working directory (CWD), e.g. the BSD getcwd function, or just c ...
to ''/home/pete'' by invoking the program '' cd'': cd /home/pete The following bash command writes "Hello World" via program
echo In audio signal processing and acoustics, an echo is a reflection of sound that arrives at the listener with a delay after the direct sound. The delay is directly proportional to the distance of the reflecting surface from the source and the lis ...
to
standard output Standard may refer to: Symbols * Colours, standards and guidons, kinds of military signs * Standard (emblem), a type of a large symbol or emblem used for identification Norms, conventions or requirements * Standard (metrology), an object t ...
typically the terminal. Quotes around the two words indicate that the phrase is treated as a single parameter. echo "Hello World" The following demonstrates how the default behavior of a command is modified with a switch. The switch causes the command to treat characters prefixed with a backslash as the associated control character. In this case results in a tab character. echo -e "Hello\tWorld" In shells such as
command prompt A command-line interface (CLI) is a means of interacting with software via commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternativ ...
, DOS, and
OS/2 OS/2 is a Proprietary software, proprietary computer operating system for x86 and PowerPC based personal computers. It was created and initially developed jointly by IBM and Microsoft, under the leadership of IBM software designer Ed Iacobucci, ...
some commands are built-in; are not implemented as a separate program. But, if a command is not built-in, then the shell dispatches to a program that has an executable extension (such as ''.exe'') and base name matching the first parameter ignoring case. The following command prompt command displays the content of file ''readme.txt'' via the built-in command ''
type Type may refer to: Science and technology Computing * Typing, producing text via a keyboard, typewriter, etc. * Data type, collection of values used for computations. * File type * TYPE (DOS command), a command to display contents of a file. * ...
''. type readme.txt The following command prompt command lists the contents of the current directory via built-in command '' dir''. The switch ''/Q'' modifies default behavior to include owner information. dir /Q


See also

*
Formal grammar A formal grammar is a set of Terminal and nonterminal symbols, symbols and the Production (computer science), production rules for rewriting some of them into every possible string of a formal language over an Alphabet (formal languages), alphabe ...
*
Gesture recognition Gesture recognition is an area of research and development in computer science and language technology concerned with the recognition and interpretation of human gestures. A subdiscipline of computer vision, it employs mathematical algorithms to ...
* List of POSIX commands *
List of DOS commands This article lists notable commands provided by the MS-DOS disk operating system (DOS), especially as used on an IBM PC compatible computer. Other DOS variants as well as the legacy Windows shell, Command Prompt (cmd.exe), provide many of these c ...


References


External links


command
from FOLDOC
Windows Commands , Microsoft Docs
{{Windows commands User interfaces Computing terminology