Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...
, a command
is a directive to a computer program acting as an interpreter of some kind, in order to perform a specific task. Most commonly a command is a directive to some kind of command line interface, such as a shell
A shell is a piece of software that provides an interface for users of an operating system which provides access to the services of a kernel. However, the term is also applied very loosely to applications and may include any software that is "built around" a particular component, such as web...
Specifically, the term command
is used in imperative
In computer science, imperative programming is a programming paradigm that describes computation in terms of statements that change a program state...
computer languages. These languages are called this, because statements
In computer programming a statement can be thought of as the smallest standalone element of an imperative programming language. A program written in such a language is formed by a sequence of one or more statements. A statement will have internal components .Many languages In computer programming...
in these languages are usually written in a manner similar to the imperative mood
The imperative mood expresses commands or requests as a grammatical mood. These commands or requests urge the audience to act a certain way. It also may signal a prohibition, permission, or any other kind of exhortation.- Morphology :...
used in many natural language
In the philosophy of language, a natural language is any language which arises in an unpremeditated fashion as the result of the innate facility for language possessed by the human intellect. A natural language is typically used for communication, and may be spoken, signed, or written...
s. If one views a statement in an imperative language as being like a sentence in a natural language, then a command is generally like a verb in such a language.
Many programs allow specially formatted arguments, known as flags, which modify the default behaviour of the command, while further arguments
In computer programming, a parameter is a special kind of variable, used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. These pieces of data are called arguments...
describe what the command acts on. Comparing to a natural language: the flags are adverbs, whilst the other arguments are object
An object in grammar is part of a sentence, and often part of the predicate. It denotes somebody or something involved in the subject's "performance" of the verb. Basically, it is what or whom the verb is acting upon...
Here are some commands given to a command line interpreter (Unix shell
A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems...
This command changes the user's place in the directory tree from their current position to the directory /home/pete
is the command and /home/pete
is the argument:
This command prints the text hello
out to the standard output stream, which, in this case, will just print the text out on the screen. echo
is the command and "Hello World"
is the argument. The quotes are used to prevent Hello
being treated as separate arguments:
These commands are equivalent. They list files in the directory /bin
In computing, ls is a command to list files in Unix and Unix-like operating systems. ls is specified by POSIX and the Single UNIX Specification.- History :An ls utility appeared in the original version of AT&T UNIX...
is the command, /bin
The Filesystem Hierarchy Standard defines the main directories and their contents in Linux operating systems. For the most part, it is a formalization and extension of the traditional BSD filesystem hierarchy....
is the argument and there are three flags: -l
This displays the contents of the files ch1.txt
The cat command is a standard Unix program used to concatenate and display files. The name is from catenate, a synonym of concatenate.- Specification :...
is the command and ch1.txt
are both arguments.
This lists all the contents of the current directory. dir
is the command and "A" is a flag. There is no argument. Here are some commands given to a different command line interpreter (the DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...
and Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
command prompt). Notice that the flags are identified differently but that the concepts are the same:
This displays the contents of the file readme.txt. type
In computing, type is a command in various VMS. AmigaDOS, CP/M, DOS, OS/2 and Microsoft Windows command line interpreters such as COMMAND.COM, cmd.exe, 4DOS/4NT and Windows PowerShell. It is used to display the contents of specified files...
is the command. "readme.txt" is the argument. "P" is a parameter...