World Library  
Flag as Inappropriate
Email this Article

Command (computing)

Article Id: WHEBN0000215461
Reproduction Date:

Title: Command (computing)  
Author: World Heritage Encyclopedia
Language: English
Subject: Inter-protocol exploitation, Shutdown (computing), Drawing Express, ATTRIB, Chsh
Collection: Computing Commands, Computing Terminology, User Interfaces
Publisher: World Heritage Encyclopedia

Command (computing)

In computing, 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 either a directive to some kind of command-line interface, such as a shell, or an event in a graphical user interface triggered by the user selecting an option in a menu.

Specifically, the term command is used in imperative computer languages. These languages are called this, because statements in these languages are usually written in a manner similar to the imperative mood used in many natural languages. 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 or options, which modify the default behaviour of the command, while further arguments describe what the command acts on. Comparing to a natural language: the flags are adverbs, whilst the other arguments are objects.


Here are some commands given to a command-line interpreter (Unix shell).

The following command changes the user's place in the directory tree from their current position to the directory /home/pete. The command is cd and the argument is /home/pete:

 cd /home/pete

The following command prints the text Hello World out to the standard output stream, which, in this case, will just print the text out on the screen. The command is echo and the argument is "Hello World". The quotes are used to prevent Hello and World being treated as separate arguments:

 echo "Hello World"

The following commands are equivalent. They list files in the directory /bin. The command is ls, the argument is /bin and there are three flags: -l, -t and -r.

 ls -l -t -r  /lvl 100
 ls -ltr  /bin

The following command displays the contents of the files ch1.txt and ch2.txt. The command is cat, and ch1.txt and ch2.txt are both arguments.

 cat ch1.txt ch2.txt

Here are some commands given to a different command-line interpreter (the DOS, OS/2 and Microsoft Windows command prompt). Notice that the flags are identified differently but that the concepts are the same:

The following command lists all the contents of the current directory. The command is dir, and "A" is a flag. There is no argument.

 dir /A

The following command displays the contents of the file readme.txt. The command is type. The argument is "readme.txt". "P" is a parameter.

 type /P readme.txt

See also

External links

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.