ArticleslgStudy

computer science

Command (computing)

Command (computing) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Command (computing) rather than just read about it. In short: In computing, a command is a high-level instruction received via an external interface that directs the behavior of a computer program. Commonly, commands are sent to a program via a command-line interface, a script, a network protocol, or as an event triggered in a graphical user interface.

Key takeaways

  • Command (computing) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Command (computing) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Command (computing) from memory before moving on to harder problems.

Reference excerpt

In computing, a command is a high-level instruction received via an external interface that directs the behavior of a computer program. Commonly, commands are sent to a program via a command-line interface, a script, a network protocol, or as an event triggered in a graphical user interface. 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) with a prefix such as dash or a slash that modifies default behavior. An option might have a required value that follows it. Typically, a 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 or path. 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, 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 shell. Commonly, the shell dispatches a command to a program that has a file name matching the first parameter. In a Unix shell (such as bash and many related variants), the match must be exact including case. The following bash command changes the working directory to /home/pete by invoking the program cd:

The following bash command writes "Hello World" via program echo to standard output – typically the terminal. Quotes around the two words indicate that the phrase is treated as a single parameter.

The following demonstrates how the default behavior of a command is modified with a switch. The switch -e causes the command to treat characters prefixed with a backslash as the associated control character. In this case \t results in a tab character.

In shells such as command prompt, DOS, and OS/2 some commands are built-in: 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.

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.

See also Formal grammar Gesture recognition List of POSIX commands List of DOS commands

References

External links

command from FOLDOC Windows Commands | Microsoft Docs

Worked examples

Example 1 — a first encounter with Command (computing)

Start with the simplest possible case. Write down what Command (computing) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Command (computing) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Command (computing) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Command (computing)

In research
Command (computing) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Command (computing) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Command (computing) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computing commands, Computing terminology, User interfaces, so understanding it makes those chapters shorter.
In everyday life
Look for Command (computing) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Command (computing)” →

How to study Command (computing) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Command (computing) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Command (computing) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Command (computing) in simple terms?

In computing, a command is a high-level instruction received via an external interface that directs the behavior of a computer program. Commonly, commands are sent to a program via a command-line interface, a script, a network protocol, or as an event triggered in a graphical user interface.

Why does Command (computing) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Command (computing)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Command (computing).

Tags

  • Computing commands
  • Computing terminology
  • User interfaces
  • Windows commands

Keep exploring