A command is an instruction to a computer program to act as an interpreter for solving a problem. More generally, a command is an indication of a command line interface, such as a shell .
In particular, the term command is used in imperative programming languages . These languages are so named because their operators are usually written like verbs in the imperative mood used in many natural languages . If you look at the operator of an imperative language as a sentence of a natural language, then the command is generally similar to a verb.
Many programs allow the use of specially formatted arguments, known as keys, that modify the standard behavior of the command, while additional arguments describe the actions of the command. Compare with natural language: adverbs correspond to keys, while additions correspond to other arguments.
Examples
The following are a few commands for the UNIX operating system command line interpreter (UNIX shell).
- cd / home / pete
- The
cdchanges the user’s location in the directory tree from the current directory to the / home / pete directory.
- echo "hello"
- The echo command outputs hello text to the standard output stream, which, in this case, prints this text on the screen. Quotation marks (note: not the same as those used on Wikipedia) are needed to display several words separated by spaces, but it all depends on the specific implementation of the command: it is possible to display several words even without quotes; quotation marks are possible as an argument to a command, that is, text output along with them.
- ls -ltr / bin
- The
lsdisplays a list of all files in the / bin directory in full form ( -l switch), sorted by time ( -t switch) in reverse order ( -r switch).
- chmod +755 [filename]
- The chmod command is used to provide read, write, or execute access to a file named filename . In a character record, the first digit indicates user rights, while the other two digits are used to indicate the rights of user groups to read, write or execute your file.
- 1 - access to your file for execution,
- 2 - access to your file for recording,
- 4 - read access to your file.
- 4 + 1 = 5 means that your file has only read and execute access,
- 4 + 2 + 1 = 7 means that your file has read, write and execute access.
See also
- DOS Command List
- Formal grammar