ArticleslgStudy

science

Command (Unix)

Command (Unix) is a 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 (Unix) rather than just read about it. In short: command is a Unix shell command for looking up commands. The command is available on Unix and Unix-like operating systems.

Key takeaways

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

Reference excerpt

command is a Unix shell command for looking up commands. The command is available on Unix and Unix-like operating systems. It is specified in the POSIX standard and is often implemented in Unix shells as a shell builtin function or alias.

Usage command has two main modes: execution and inspection, depending on the optional flags that are specified as its first command-line arguments.

Execution By default, command takes the name of a command, followed by zero or more arguments for it. It then follows a special procedure to look up the command name, and runs it with the given arguments. This procedure makes the following modifications to normal command execution:

It bypasses shell functions, aliases, and reserved words, which would normally take precedence. Even if it runs a "special built-in utility", it handles errors and variable assignments like it would for a normal command. In this mode, it can have the following exit statuses:

The status produced by the target command, if it was run. 126 if the command was found but could not be run. 127 if there is no command by the given name, or command had some other error condition.

Inspection When the -v flag or the -V flag is specified, command takes just the name of a command, and outputs information about it. The -v flag causes command to expand the given name, outputting what it refers to: (followed by a newline character)

The absolute path of an executable The definition of an alias The name of a shell function or built-in Nothing if the lookup fails The -V flag causes command to output a human-readable description of what the name refers to, specifying whether it is an executable (including its absolute path), function, alias (including its definition), special or regular built-in, or shell reserved word. In this mode, the exit status is 0 on success and positive on error.

Mode-independent flags command has one mode-independent flag, -p. This causes it to override the PATH environment variable and instead use a default value on which all of the standard utilities are located.

Examples In the following, the ls command is run directly instead of invoking a function or alias with the same name.

See also List of POSIX commands

Main sources command – Shell and Utilities Reference, The Single UNIX Specification, Version 5 from The Open Group The documentation for command(1p) is also available at websites such as manned.org and man7.org.

Additional references

Worked examples

Example 1 — a first encounter with Command (Unix)

Start with the simplest possible case. Write down what Command (Unix) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In 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 (Unix) 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 (Unix) 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 (Unix)

In research
Command (Unix) appears in 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 (Unix) 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 (Unix) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Standard Unix programs, so understanding it makes those chapters shorter.
In everyday life
Look for Command (Unix) 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 (Unix)” →

How to study Command (Unix) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Command (Unix) 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 (Unix) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Command (Unix) in simple terms?

command is a Unix shell command for looking up commands. The command is available on Unix and Unix-like operating systems.

Why does Command (Unix) matter?

Because it connects several 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 (Unix)?

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 (Unix).

Tags

  • Standard Unix programs

Keep exploring