Updated:

The shape of a command

/give @p minecraft:diamond 5

Command name (give), target (@p), item ID (minecraft:diamond), amount (5). Each command has its own argument order, and swapping arguments causes an error.

Reading the notation in guides

NotationMeaning
<target>Required argument
[amount]Optional; a default is used if left out
clear|rain|thunderPick one

/weather <clear|rain|thunder> [duration] means /weather clear alone works. Do not type the brackets themselves.

Typing rules

Allow commands

In single player, turn on Allow Cheats when creating the world. Afterwards, Java can allow them temporarily through Open to LAN, and Bedrock through the world settings (which disables achievements). On a server you need operator status: run op PlayerName in the console. Without permission, Java may simply say the command is unknown.

Use the suggestions

Java shows suggestions as you type, and Tab completes them. If the text turns red, the game stopped understanding it from that point. Bedrock also shows syntax hints while typing.

Reading error messages

Unknown item 'minecraft:diamond_swrod'
...give @p minecraft:diamond_swrod<--[HERE]

Java marks the problem with <--[HERE]. Look at the word just before it; here it is a typo. More in unknown or incomplete command.

Build long commands with a tool

Named and enchanted items or summons with NBT are easy to break with a missing bracket. Build them in the give generator or similar, then edit only what you need.

Common questions

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.