Terminal and commandsUnit 2 of 3
Beginner18 minIn reviewTranslation in review

Command names, options, arguments and help

Read a command before running it and use built-in help to verify its grammar.

What you will learn
  • Identify the command name, options and arguments in a short command line.
  • Use the command's own help before relying on remembered syntax.
Know this first
  • Terminal
  • Command
  • File
  • Folder
Start this unit
Last verifiedReview every 365 days
On this page

Read the structure first

Consider this Linux-shell command:

ls -l notes
│  │  └── argument: the item to inspect
│  └───── option: changes the form of the result
└──────── command name: selects the operation

An option changes how an operation behaves. An argument supplies a target or value. The exact grammar belongs to that command; not every tool uses the same option style.

Verify the grammar

Use documentation provided by the command or its environment:

EnvironmentTypical help routeWhat it answers
Linux shellcommand --help or man commandAccepted options, arguments and examples
PowerShellGet-Help Command-NameSyntax, parameters and examples
Windows CMDcommand /?Command syntax and switches

These forms are conventions, not universal laws. If one form fails, consult the platform's official documentation rather than guessing another option.

Output and exit status

Text printed to the terminal is output. Separately, a command returns an exit status to the shell. A command can print nothing and still succeed; it can also print a useful message and still report failure. Verify the resulting state when the command changes something.

Practise reading commands

TRY IT HERE

Ask the shell where you are, what is there and what one file contains.

Deterministic simulator: no real shell, network or access to your files.

Suggested sequence

$ …

What happened: Each command made one request. Output described state; clear changed only the visible transcript.

Before each command, say aloud:

  1. the command name;
  2. each option;
  3. each argument;
  4. what you expect to observe or change.
Next stepNavigate and change virtual state

Apply the same reading method to small, reversible changes in the deterministic simulator.