Commands
Contents
- 1 Usage
- 2 Summary of commands
- 3 Command Guide
- 4 List of commands
- 4.1 advancement
- 4.2 ban
- 4.3 blockdata
- 4.4 clear
- 4.5 clone
- 4.6 data[upcoming 1.13]
- 4.7 datapack[upcoming 1.13]
- 4.8 debug
- 4.9 defaultgamemode
- 4.10 deop
- 4.11 difficulty
- 4.12 effect
- 4.13 enchant
- 4.14 entitydata
- 4.15 experience[upcoming 1.13]
- 4.16 execute
- 4.17 fill
- 4.18 function
- 4.19 gamemode
- 4.20 gamerule
- 4.21 give
- 4.22 help
- 4.23 kick
- 4.24 kill
- 4.25 list
- 4.26 locate
- 4.27 me
- 4.28 op
- 4.29 pardon
- 4.30 particle
- 4.31 playsound
- 4.32 publish
- 4.33 recipe
- 4.34 reload
- 4.35 replaceitem
- 4.36 save
- 4.37 say
- 4.38 scoreboard
- 4.39 seed
- 4.40 setblock
- 4.41 setidletimeout
- 4.42 setmaxplayers
- 4.43 setworldspawn
- 4.44 spawnpoint
- 4.45 spreadplayers
- 4.46 stats
- 4.47 stop
- 4.48 stopsound
- 4.49 summon
- 4.50 teleport
- 4.51 tell
- 4.52 tag[upcoming 1.13]
- 4.53 team[upcoming 1.13]
- 4.54 tellraw
- 4.55 testfor
- 4.56 testforblock
- 4.57 testforblocks
- 4.58 tickingarea
- 4.59 time
- 4.60 title
- 4.61 toggledownfall
- 4.62 tp
- 4.63 transferserver
- 4.64 trigger
- 4.65 weather
- 4.66 whitelist
- 4.67 worldborder
- 4.68 wsserver
- 5 Education Edition commands
- 6 Removed commands
- 7 Video
- 8 History
- 9 Issues
- 10 See also
Commands, in the Java, Bedrock, and Education Edition, are advanced features activated by typing certain strings of text.
Usage[edit | edit source]
In a regular Minecraft client or the stand alone client, commands are entered via Minecraft's chat window, which is displayed by pressing the T key (default) or / key. Using the / key will also enter the forward slash that commands require as a prefix, so it is a useful shortcut. The ↑ and ↓ key can be used to enter the previously executed command. Pressing Tab ↹ while entering commands cycles through possible commands or arguments, and can be used to auto-enter the coordinates of the block looked at before entering chat.
Commands may also be entered in a multiplayer server's console, but are not preceded by a / when entered this way. A server admin running commands in this way is often referred to as "ghosting".
Commands in command blocks can be preceded by a slash, but it is not required. Commands in a command block usually also require an optional argument, like a player's username.
The majority of commands are only available in the following situations:
- In a Minecraft multiplayer server game, entered by an operator or command block.
- In other multiplayer games, entered by the player who opened a LAN game with cheats enabled, or is hosting their own multiplayer server
- In singleplayer, if cheats were enabled at world creation (via the "More World Options..." button).
Some player commands are also available in singleplayer even when cheats are not enabled.
Note: In singleplayer worlds where cheats were not enabled at creation, they can be enabled on a temporary basis by opening the current game session to LAN play ( Esc → "Open to LAN", then "Allow Cheats" button and "Start LAN World"). You do not actually need to be on a LAN or have others join. This is not permanent, but will allow the use of commands until you quit the world, and changes you make via commands (items spawned, etc.) will be saved with the world. You can do this each time you start playing the world again. Note that this will disable game pausing for the duration, so while open to LAN, you should get somewhere safe or reload your world before using the Game Menu. Remember that you can disable your LAN world by reloading the world.
Tilde notation[edit | edit source]
Many commands allow relative coordinates to be specified using tildes (~). A number following a tilde is an offset from something rather than a coordinate. The sign of the offset specifies whether to go in the positive or negative direction for that axis. A single tilde by itself is shorthand for ~0.
For example, /tp 0 64 0 will teleport the user to the coordinate (0, 64, 0), while /tp ~3 ~ ~-3 will teleport the user to a position +3 blocks in the "x" direction (i.e., east), keep their current height, and -3 blocks in the "z" direction (i.e., north).
Usually absolute coordinates can be mixed with relative coordinates. For example, /tp ~ 64 ~ will keep the user's "x" and "z" coordinates the same, but teleport them to absolute height of 64.
The origin for the offset depends on the command. For example, in /tp the offset is from the target's starting position. Other common offsets include from the position of the command's execution or from another coordinate specified by the command.
Target selectors[edit | edit source]
In most commands where a player may be specified as an argument, it is possible to "target" one or more players satisfying certain conditions instead of specifying players by name. To target players by condition, choose a target selector variable and, optionally, one or more target selector arguments to modify the conditions to be satisfied.
For example, to change the game mode of all players on team Red to creative mode, instead of specifying them by name individually:
/gamemode creative @a[team=Red]
Target selector variables[edit | edit source]
| Variable | Function |
|---|---|
@p |
nearest player |
@r |
random player |
@a |
all players |
@e |
all entities |
@s |
the entity executing the command |
A target selector variable identifies the broad category of targets to select. There are five variables:
-
@p
- Targets the nearest player. When run by the console, the origin of selection will be at (0, 0, 0). If there are multiple nearest players, caused by them being precisely the same distance away, the player who most recently joined the server is selected.
- Target selector arguments may be used to reduce the set of players from which the nearest player will be selected. For example,
@p[team=Red]will target the nearest player on team Red even if there are other players closer.
- The
ctarget selector argument can be used to increase the number of nearest players targeted (for example,@p[c=3]will target the three nearest players). When negative,cwill reverse the order of targeting (for example,@p[c=-1]will target the farthest player).
-
@r
- Targets a random player (or entity with the
typetarget selector argument).
- Target selector arguments may be used to reduce the set of players from which a random player will be targeted. For example,
@r[team=Red]will only target a random player from team Red.
- The
ctarget selector argument can be used to increase the number of random players targeted. For example,@r[c=3]will target three random players.
- When used without the
typeargument,@ralways targets a random player. Thetypeargument can be used to target non-player entities (for example,@r[type=zombie]will target a random zombie,@r[type=!player]will target a random non-player entity,@r[type=!zombie]will target a random non-zombie, etc.).
-
@a
- Targets all players, including dead players. No other selector will find dead players, except
@s.
- Target selector arguments may be used to reduce the set of players targeted. For example,
@a[team=Red]will only target players on team Red.
-
@e
- Targets all entities (including players).
- Target selector arguments may be used to reduce the set of entities targeted. For example,
@e[type=cow]will only target cows.
-
@s
- Targets only one entity: the entity that executed the command, including dead players. If the executor was not an entity, for instance if the executor was a command block or a server console, this selector will find nothing.
- Target selector arguments may be used to specify whether the executor is actually eligible to be targeted. For example,
@s[type=cow,team=Red]will only target the executor of the command, if the executor was a cow on team Red.
Target selector arguments[edit | edit source]
| Selection by Position | |
|---|---|
| Argument(s) | Selection criteria |
x, y, z
|
coordinate |
r, rm
|
radius (max, min) |
dx, dy, dz
|
volume dimensions |
| Selection by Scoreboard Values | |
| Argument(s) | Selection criteria |
score_name
|
max score |
score_name_min
|
min score |
tag
|
scoreboard tag |
team
|
team name |
| Selection by Traits | |
| Argument(s) | Selection criteria |
c
|
count |
l, lm
|
experience level (max, min) |
m
|
game mode |
name
|
entity name |
rx, rxm
|
vertical rotation (max, min) |
ry, rym
|
horizontal rotation (max, min) |
type
|
entity type |
After using a target selector, you can optionally use arguments to modify the set of targets selected. When used with @a or @e, arguments narrow down the number of targets from the full list to a specific few. When used with @p or @r, arguments narrow the number of targets down from the full list to a smaller set from which the nearest or random player is selected.
Add argument-value pairs as a comma-separated list contained within square brackets after the target selector variable:
-
@<variable>[<argument>=<value>,<argument>=<value>,…].
Arguments and values are case-sensitive. Spaces are not allowed around the brackets, equal signs, or commas, and only commas may be used to separate argument-value pairs.
- Selecting targets by coordinate
-
[x=X,y=Y,z=Z]— Selects targets based on distance to that exact position. Combine with selecting by radius to select only targets at that specific position.
- The coordinates have to be integers and must be exact - tilde notation is not available for selector argument coordinates.
- Selecting targets by radius
-
[r=R]— Selects only targets less than R blocks from the command's execution. Using a value under 0 restricts the targets to the same dimension the command was run from without applying a restriction on distance from the location of execution. -
[rm=RM]— Selects only targets more than RM blocks from the command's execution.
- If a coordinate (above) and either or both radius/i are both defined, the radius/i will center on the coordinate rather than the postion of the command's execution.
- Selecting targets by volume
-
[dx=DX,dy=DY,dz=DZ]
- Selects only targets within the volume defined as starting from the location where the command was executed and extending DX blocks in the "x" direction (i.e., east/west), DY blocks in the "y" direction (i.e., upwards/downwards), and DZ blocks in the "z" direction (i.e., north/south). If an initial coordinate is specified with the
x,y, andzarguments, that will be used instead of the position of the command's execution for the lower northwestern corner (dx,dy, anddzstill specify distances from that coordinate; they do not specify a separate coordinate).
- It is possible to combine selection by radius and selection by volume, in which case the command will only select targets within the overlap of both regions (within certain radius/i of the volume's lower northwest corner and not outside the defined volume).
- Selecting targets by score
-
[score_name=SCORE]— Selects only targets with a score in objective name of no more than SCORE.
-
[score_name_min=SCOREMIN]— Selects only targets with a score in objective name of no less than SCOREMIN.
- For example,
@a[score_points_min=30,score_points=39]will select all players with a score in objective "points" between 30 and 39 (inclusive).
- See also: Scoreboard § Objectives
- Selecting targets by tag
-
[tag=TAG]— Selects only targets that have been given the scoreboard tag TAG. -
[tag=!TAG]— Selects only targets that have not been given the scoreboard tag TAG. -
[tag=]— Selects only targets without any scoreboard tags. -
[tag=!]— Selects only targets with any scoreboard tags.
- See also: Scoreboard § Tags_commands
- Selecting targets by team
-
[team=TEAM]— Selects only targets on team TEAM.
-
[team=!TEAM]— Selects only targets not on team TEAM.
-
[team=]— Selects only targets not on any team.
-
[team=!]— Selects only targets on any team.
- See also: Scoreboard § Teams
- Selecting targets by count
-
[c=C]— Selects only the specified number of targets. Usually in order of distance from the command executor.
- When used with
@por@r, this argument defaults to 1, so using a higher number will increase the number of nearest or random targets returned. When used with@aor@e, this argument returns only the nearest targets.
- If there are multiple nearest targets, caused by them being precisely the same distance away, targets are sorted by the time they have been on the server (since their most recent join for players or their creation for other entities) with the longest times selected first. For example, if equally distant,
@a[c=1]will select the player who has been on the server the longest and@e[type=creeper,c=3]will select the three oldest creepers.
- When used with a negative value, the order of targets is reversed. For example,
@p[c=-3]will return the three farthest targets, and, if all potential targets are equally far away,@e[c=-3]will select the last three targets created.
- Selecting targets by experience level
[Java Edition only]
-
[l=L]— Selects only targets with no more than L experience levels.
-
[lm=LM]– Selects only targets with no less than LM experience levels. - This automatically filters out all non-player targets.
- Selecting targets by game mode
-
[m=M]— Selects only targets on the specified game mode. -
[m=!M]— Selects only targets that are not on the specified game mode. - Permitted values for M are:
-
0,s,survival: survival mode -
1,c,creative: creative mode -
2,a,adventure: adventure mode -
3,sp,spectator: spectator mode[Java Edition only]
-
- This automatically filters out all non-player targets.
- Selecting targets by name
-
[name=NAME]— Selects only targets named NAME.
-
[name=!NAME]— Selects only targets not named NAME.
- Selecting targets by vertical rotation
-
[rx=RX]— Selects only targets with a maximum vertical rotation of RX. -
[rxm=RXM]— Selects only targets with a minimum vertical rotation of RXM.
- Vertical rotation values vary from 270 facing straight up, increasing to 359 just above horizontal, then 0 at horizontal increasing to 90 facing straight down (thus vertical rotation values increase with rotation downwards).
- Selecting targets by horizontal rotation
-
[ry=RY]— Selects only targets with a maximum horizontal rotation of RY. -
[rym=RYM]— Selects only targets with a minimum horizontal rotation of RYM.
- Horizontal rotation values vary from -180 (facing due north), to -90 (facing due east), to 0 (facing due south), to 90 (facing due west), to 180 (just west of due north) before wrapping back to -180 (thus horizontal rotation values increase with rotation to the right, or clockwise viewed from above).
- Selecting targets by type
-
[type=TYPE]— Selects only targets of the specific entity type. -
[type=!TYPE]— Selects only targets not of the specific entity type.
- TYPE must be an entity ID used to identify different types of entities internally (for example,
creeperfor creepers,minecartfor regular minecarts,tntfor primed TNT, etc.). Entity IDs are case-sensitive and invalid entity IDs will cause the command to fail.
- When used with
@r, can change its normal behavior of targeting only players to target other entities.
Data tags[edit | edit source]
A data tag is a sequence of text which describes a data structure using attribute-value pairs. Data tags are used in Java Edition commands to specify complex data for players, entities, and some blocks.
A data tag consists of zero or more attribute-value pairs separated by commas and delineated by curly brackets. Each attribute-value pair consists of an attribute name and the attribute's value, separated by a colon. Some values, however, may themselves contain attribute-value pairs, allowing a data tag to describe a hierarchical data structure.
- Example:
{name1:123,name2:"sometext",name3:{subname1:456,subname2:789}}
The data structures that data tags describe are the same ones used in Minecraft's save files. These data structures are described in other articles and commands expect data tags to use the same attribute names (which are case-sensitive):
| Objects | Examples |
|---|---|
| Block entities | chests, furnaces, command blocks, mob spawners, signs, etc. |
| Items | items in inventories (includes specifications for enchantments, lore, custom names, etc.) |
| Item entities | items on the ground |
| Mobs | creepers, cows, villagers, etc. |
| Projectiles | arrows, fireballs, thrown potions, etc. |
| Vehicles | boats, minecarts, etc. |
| Dynamic tiles | primed TNT, falling sand/gravel/anvils |
| Other entities | firework rockets, paintings, and item frames |
The defined data structures also expect the values to be of the correct type.
| Type | Description |
|---|---|
| Byte |
An integer between -128 and 127 (inclusive). |
| Short |
An integer between -32,768 and 32,767 (inclusive). |
| Int |
An integer between -2,147,483,648 and 2,147,483,647 (inclusive). |
| Long |
An integer between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 (inclusive). |
| Float Double |
Float - 32-bit single-precision floating point, Example: 3.1415926
Double - 64-bit double-precision floating point, Example: 3.141592653589793 See IEEE floating point for details. |
| String |
A sequence of text, optionally delineated with double quotes.
Double quotes must be used if the String contains commas, curly brackets, or square brackets. To include a double quote inside a String, add a backslash before the double quote.
|
| List |
A sequence of values, separated by commas and delineated with square brackets. The values must be of the same type, which is dictated by the first value in the sequence.
|
| Byte Array |
A sequence of integers between -128 and 127 (inclusive), separated by commas, delineated with square brackets, and prefixed with B;.
|
| Int Array |
A sequence of integers between -2,147,483,648 and 2,147,483,647 (inclusive), separated by commas, delineated with square brackets, and prefixed with I;.
|
| Long Array |
A sequence of integers between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 (inclusive), separated by commas, delineated with square brackets, and prefixed with L;.
|
| Compound |
A sequence of attribute-value pairs, separated by commas and delineated with curly brackets.
Every data tag argument is itself a Compound. |
| Boolean |
A value, expressed as "true" or "false". This is only seen in JSON formatting, as a Byte tag is usually used in NBT data to determine a boolean value as 0 (for false) and 1 (for true).
|
Some commands may require that a number's type be specified by adding a letter (B, S, L, F, D) to the end of the value. For example, 3s for a short, 3.2f for a float, etc. (This doesn't work with I for int.) The letter can be uppercase or lowercase. When no letter is used and Minecraft can't tell the type from context, it assumes double (if there's a decimal point), int (if there's no decimal point and the number is small enough to store as an int), or string (if neither is true). A square-bracketed literal is assumed to be a list unless an identifier is used: [I;1,2,3] for an int array and [L;1L,2L,3L] for a long array.
When commands such as /testfor, /testforblock, and /clear are used to match data tags, they only check for the presence of the provided tags in the target entity/block/item. This means that the entity/block/item may have additional tags and will still match. This is true even for lists and arrays: the order of a list is not acknowledged, and as long as every requested element is in the list, it will match even if there are additional elements.
The format used for data tags is a lenient form of JSON.
Raw JSON text[edit | edit source]
The /tellraw and /title commands use strict JSON syntax.
Scores and target selectors are evaluated for a Sign when it is placed or edited and for a Written Book when it is "resolved" (opened for the first time after signing). They won't update after that, and they won't work if edited onto an existing sign with an NBT editor, or onto a book that's already marked resolved. There's no way to wrap text onto the next line of a sign or the next page of a book during resolution; instead, the extra text will simply disappear.
The format of raw JSON text is a JSON Object which supports the following (mostly optional) elements:
-
The base chat component Object-
text: A string representing raw text to display directly in chat. Note that selectors such as "@a" and "@p" are not translated into player names; use selector instead. "\n" is newline (enter). -
translate: The translation identifier of text to be displayed using the player's selected language. This identifier is the same as the identifiers found in lang files from assets or resource packs. The translated text will only be displayed if the text string is not used. -
with: A list of chat component arguments and/or string arguments to be used by translate.- The arguments are text corresponding to the arguments used by the translation string in the current language, in order (for example, the first list element corresponds to "%1$s" in a translation string).
-
score: A player's score in an objective. Displays nothing if the player is not tracked in the given objective. Ignored completely if text or translate is present.-
name: The name of the player whose score should be displayed. Selectors (such as @p) can be used, in addition to "fake" player names created by the scoreboard system. In addition, if the name is "*", it will show the reader's own score (for example,/tellraw @a {"score":{"name":"*","objective":"obj"}}will show every online player their own score in the "obj" objective). -
objective: The internal name of the objective to display the player's score in. -
value: Optional. If present, this value is used regardless of what the score would have been.
-
-
selector: A string containing a selector (@p,@a,@r,@e or @s) and, optionally, selector arguments. Unlike text, the selector will be translated into the correct player/entity names. If more than one player/entity is detected by the selector, it will be displayed in a form such as 'Name1 and Name2' or 'Name1, Name2, Name3, and Name4'. Ignored completely if text, translate, or score is present. Clicking a player's name inserted into a /tellraw command this way will suggest a command to whisper to that player. Shift-clicking a player's name will insert that name into chat. Shift-clicking a non-player entity's name will insert its UUID into chat. -
keybind: A string that can be used to display the key needed to preform a certain action. An example iskey.inventorywhich will always display "E" unless the player has set a different key for opening their inventory. -
extra: A list of additional objects, sharing the same format as the base object.-
A list element with the same format as the base object (recursive). Note that all properties of this object are inherited by children except for text, extra, translate, with, and score. This means that children will retain the same formatting and events as this object unless they explicitly override them.
-
-
color: The color to render this text in. Valid values are "black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple", "gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple", "yellow", "white", and "reset" (cancels out the effects of colors used by parent objects). Technically, "bold", "italic", "underlined", "strikethrough", and "obfuscated" are also accepted, but it may be better practice to use the tags below for such formats. -
bold: Boolean (true/false) - whether to render text in bold. Defaults to false. -
italic: Boolean (true/false) - whether to render text in italics. Defaults to false. -
underlined: Boolean (true/false) - whether to render text underlined. Defaults to false. -
strikethrough: Boolean (true/false) - whether to render text with a strikethrough. Defaults to false. -
obfuscated: Boolean (true/false) - whether to render text obfuscated. Defaults to false. -
insertion: When the text is shift-clicked by a player, this string will be inserted in their chat input. It will not overwrite any existing text the player was writing. -
clickEvent: Allows for events to occur when the player clicks on text.-
action: The action to perform when clicked. Valid values are "open_url" (opens value as a URL in the player's default web browser), "open_file" (opens the value file on the user's computer), "run_command" (has value entered in chat as though the player typed it themselves. This can be used to run commands, but the command will fail if the player does not have the required permissions to use it), "change_page" (can only be used in written books) changes to page value if that page exists, and "suggest_command" (similar to "run_command" but it cannot be used in a written book, the text only appears in the player's chat input and it is not automatically entered. Unlike insertion, this will replace the existing contents of the chat input). "open_file" is used in messages automatically generated by the game (e.g. on taking a screenshot) and cannot be used in commands or signs. -
value: The URL, file, chat, command or book page used by the specified action. Note that commands must be prefixed with the usual "/" slash.
-
-
hoverEvent: Allows for a tooltip to be displayed when the player hovers their mouse over text.-
action: The type of tooltip to show. Valid values are "show_text" (shows raw JSON text), "show_item" (shows the tooltip of an item which can have NBT tags), and "show_entity" (shows an entity's name, possibly its type, and its UUID). -
value: The formatting of this tag varies depending on the action. Note that "show_text" is the only action to support an Object as the value; all other action values are Strings and should thus be wrapped in quotes.- "show_text": Can be either a raw String of text, or an Object with the same formatting as this base object. Note that clickEvent and hoverEvent do not function within the tooltip, but the formatting and extra tags still work.
- "show_item": A string formatted like item NBT data. Contains the "id" tag, and optionally the "Damage" tag and "tag" tag (which is the same compound used as "dataTag" in the
/givecommand). - "show_entity": A string formatted like a compound with the string values "type" (such as "Zombie"), "name", and "id" (should be an entity UUID, but can actually be any string).
-
-
Due to the extra tag, the above format may be recursively nested to produce very complex and functional text strings. However, a raw json text doesn't have to be complicated at all: virtually all properties are optional and may be left out.
To be valid, each object must have at least either text, translate, score, selector or keybind (everything else is optional). As a matter of shorthand, however, the entire Object may be substituted with a String. In this case, that string will be considered the value of the text property. For example, "This is raw text" is equivalent to {"text":"This is raw text"}. This shorthand substitution is valid anywhere a raw text object is required (including the base <raw json message> argument of /tellraw, the elements of the extra list, and the value of a "show_text" hover_event).
/tellraw also accepts an array of objects and/or strings; they are concatenated. It even accepts a tree of nested arrays; they are traversed depth-first. For example:
/tellraw @a ["Hello there, ",{"selector":"@p"},"."]
/tellraw @a [[[["The "],[["quick ","brown "],[{"selector":"@p"}," jumps "],"over "],"the "],["lazy ","dog."]]]
Finally, unlike other commands using JSON, /tellraw Strings support Unicode via the notation \u####, where #### is the Unicode hexadecimal number for the desired character.
- External links
Block/item names[edit | edit source]
Many commands have arguments that identify particular types of blocks or items. In the command syntax below these typically appear as elements named <block>, <item>, or the like which are replaced with identifiers such as minecraft:stone in the examples. In the Java edition, these identifiers are namespaced and all have the "minecraft:" prefix; in Bedrock Edition this prefix must be omitted.
Summary of commands[edit | edit source]
The table below summarizes available commands. Click a column heading to sort by that column.
| Command | Description | BE | EE | JE | OP level | MP Only | |
|
|
|
|---|---|---|---|---|---|---|---|---|---|---|
/ability
|
Grants or revokes a player ability. | — | Yes | — | 2 | — | — | — | |
— |
/advancement
|
Gives, removes, or checks player advancements. | — | — | Yes | 2 | — | — | — | |
— |
/ban
|
Adds player to banlist. | — | — | Yes | 3 | MP | — | — | |
— |
/ban-ip
|
Adds IP address to banlist. | — | — | Yes | 3 | MP | — | — | |
— |
/banlist
|
Displays banlist. | — | — | Yes | 3 | MP | — | — | |
— |
/blockdata
|
Modifies the data tag of a block. | — | — | Yes | 2 | — | |
— | — | — |
/clear
|
Clears items from player inventory. | Yes | Yes | Yes | 2 | — | — | — | |
— |
/clone
|
Copies blocks from one place to another. | Yes | Yes | Yes | 2 | — | |
— | — | — |
/debug
|
Starts or stops a debugging session. | — | — | Yes | 3 | — | — | — | — | — |
/defaultgamemode
|
Sets the default game mode. | — | — | Yes | 2 | — | — | — | — | |
/deop
|
Revokes operator status from a player. | Yes | Yes | Yes | 3 | MP | — | — | |
— |
/difficulty
|
Sets the difficulty level. | Yes | Yes | Yes | 2 | — | — | — | |
— |
/effect
|
Add or remove status effects. | Yes | Yes | Yes | 2 | — | — | |
|
— |
/enchant
|
Enchants a player item. | Yes | Yes | Yes | 2 | — | — | — | |
— |
/entitydata
|
Modifies the data tag of an entity. | — | — | Yes | 2 | — | — | |
— | — |
/execute
|
Executes another command. | Yes | Yes | Yes | 2 | — | — | — | — | — |
/fill
|
Fills a region with a specific block. | Yes | Yes | Yes | 2 | — | |
— | — | — |
/function
|
Runs a function. | — | — | Yes | 2 | — | — | — | — | — |
/gamemode
|
Sets a player's game mode. | Yes | Yes | Yes | 2 | — | — | — | |
— |
/gamerule
|
Sets or queries a game rule value. | Yes | Yes | Yes | 2 | — | — | — | — | |
/give
|
Gives an item to a player. | Yes | Yes | Yes | 2 | — | — | — | |
— |
/help
|
Provides help for commands. | Yes | Yes | Yes | 0 | — | — | — | — | — |
/kick
|
Kicks a player off a server. | — | — | Yes | 3 | MP | — | — | |
— |
/kill
|
Kills entities (players, mobs, items, etc.). | Yes | Yes | Yes | 2 | — | — | |
|
— |
/list
|
Lists players on the server. | Yes | Yes | Yes | 0 | MP | — | — | |
— |
/locate
|
Locates closest structure. | Yes | Yes | Yes | 2 | — | — | — | — | |
/me
|
Displays a message about yourself. | Yes | Yes | Yes | 0 | — | — | — | |
— |
/op
|
Grants operator status to a player. | Yes | Yes | Yes | 3 | MP | — | — | |
— |
/pardon
|
Removes entries from the banlist. | — | — | Yes | 3 | MP | — | — | |
— |
/particle
|
Creates particles. | — | — | Yes | 2 | — | — | — | |
— |
/playsound
|
Plays a sound. | Yes | Yes | Yes | 2 | — | — | — | |
— |
/publish
|
Opens single-player world to local network. | — | — | Yes | 4 | SP only | — | — | — | |
/recipe
|
Gives or takes player recipes. | — | — | Yes | 2 | — | — | — | |
— |
/reload
|
Reloads loot tables, advancements, and functions from disk. | — | — | Yes | 4 | — | — | — | — | |
/replaceitem
|
Replaces items in inventories. | Yes | Yes | Yes | 2 | — | |
|
|
— |
/save-all
|
Saves the server to disk. | — | — | Yes | 4 | MP | — | — | — | |
/save-off
|
Disables automatic server saves. | — | — | Yes | 4 | MP | — | — | — | |
/save-on
|
Enables automatic server saves. | — | — | Yes | 4 | MP | — | — | — | |
/say
|
Displays a message to multiple players. | Yes | Yes | Yes | 1 | — | — | — | — | — |
/scoreboard
|
Manages objectives, players, teams, and tags. | — | — | Yes | 2 | — | — | |
|
— |
/seed
|
Displays the world seed. | — | — | Yes | 2 | — | — | — | — | |
/setblock
|
Changes a block to another block. | Yes | Yes | Yes | 2 | — | |
— | — | — |
/setidletimeout
|
Sets the time before idle players are kicked. | — | — | Yes | 3 | MP | — | — | |
— |
/setmaxplayers
|
Sets the maximum number of players allowed to join. | Yes | Yes | — | 0 | — | — | — | |
— |
/setworldspawn
|
Sets the world spawn. | Yes | Yes | Yes | 2 | — | — | — | — | |
/spawnpoint
|
Sets the spawn point for a player. | Yes | Yes | Yes | 2 | — | — | — | |
— |
/spreadplayers
|
Teleports entities to random locations. | Yes | Yes | Yes | 2 | — | — | |
|
— |
/stats
|
Update objectives from command results. | — | — | Yes | 2 | — | |
|
|
— |
/stop
|
Stops a server. | — | — | Yes | 4 | MP | — | — | — | |
/stopsound
|
Stops a sound. | Yes | Yes | Yes | 2 | — | — | — | |
— |
/summon
|
Summons an entity. | Yes | Yes | Yes | 2 | — | — | |
— | — |
/teleport
|
Teleports entities. | Yes | Yes | Yes | 2 | — | — | |
|
— |
/tell
|
Displays a private message to other players. | Yes | Yes | Yes | 0 | — | — | — | |
— |
/tellraw
|
Displays a JSON message to players. | — | — | Yes | 2 | — | — | — | |
— |
/testfor
|
Counts entities matching specified conditions. | Yes | Yes | Yes | 2 | — | — | |
|
— |
/testforblock
|
Tests whether a block is in a location. | Yes | Yes | Yes | 2 | — | |
— | — | — |
/testforblocks
|
Tests whether the blocks in two regions match. | Yes | Yes | Yes | 2 | — | |
— | — | — |
/tickingarea
|
Add, remove, or list ticking areas. | Yes | Yes | — | 0 | — | — | — | — | |
/time
|
Changes or queries the world's game time. | Yes | Yes | Yes | 2 | — | — | — | — | |
/title
|
Manages screen titles. | Yes | Yes | Yes | 2 | — | — | — | |
— |
/toggledownfall
|
Toggles the weather. | Yes | Yes | Yes | 2 | — | — | — | — | |
/tp
|
Teleports entities. | Yes | Yes | Yes | 2 | — | — | |
|
— |
/transferserver
|
Transfer player to a server. | Yes | Yes | — | 0 | — | — | — | — | — |
/trigger
|
Sets a trigger to be activated. | — | — | Yes | 0 | — | — | — | |
— |
/weather
|
Sets the weather. | Yes | Yes | Yes | 2 | — | — | — | — | |
/whitelist
|
Manages server whitelist. | — | — | Yes | 3 | MP | — | — | |
— |
/worldborder
|
Manages the world border. | — | — | Yes | 2 | — | — | — | — | |
/wsserver
|
Connects to a WebSocket server. | Yes | Yes | — | 0 | — | — | — | — | — |
/xp
|
Adds or removes player experience. | Yes | Yes | Yes | 2 | — | — | — | |
— |
Command Guide[edit | edit source]
- Syntax
If you see… Then plain text Enter this literally, exactly as shown. italics Replace this with an appropriate value. <angle brackets> This is a required argument. [square brackets] This is an optional argument. x|y Pick one of the options shown.
Available options are shown separated by vertical bars: |
ellipsis … The argument may consist of multiple words separated by spaces. x: int The argument consists of numbers. y: string The argument consists of multiple words which could be separated by spaces.
- Success Conditions
- A command's Success Conditions must be met in order for the game to consider the command "successful". This is used to determine a variety of things, such as the output of a redstone comparator feeding from command block with a command. Note that not all "successful" commands actually do something, and not all "failed" commands fail to do something useful.
- Restrictions
- Describes restrictions on who can use the command or in what context.
- Operator: The command may only be used by an operator or in singleplayer mode with cheats enabled. On multiplayer servers, the results of these commands are broadcast to other ops online.
- Multiplayer: The command is only available on a multiplayer server. The following commands are restricted to multiplayer servers:
/ban,/ban-ip,/banlist,/deop,/kick,/list,/op,/pardon,/pardon-ip,/save-all,/save-off,/save-on,/setidletimeout,/stop,/whitelist.
- No multiplayer commands permit target selectors in arguments.
- Except for
/list, multiplayer commands cannot be used in command blocks. - Many of these commands can be used on players who have never been to the server, or even on names which are not (or cannot be) registered as Minecraft accounts.
- Multiplayer: The command is only available on a multiplayer server. The following commands are restricted to multiplayer servers:
- No command blocks: The command cannot be executed by a command block.
List of commands[edit | edit source]
advancement
ban
blockdata
clear
clone
data[upcoming 1.13]
datapack[upcoming 1.13]
debug
defaultgamemode
deop
difficulty
effect
enchant
entitydata
experience[upcoming 1.13]
execute
fill
function
gamemode
gamerule
give
help
kick
kill
list
locate
me
op
pardon
particle
playsound
publish
recipe
reload
replaceitem
save
say
scoreboard
seed
setblock
setidletimeout
setmaxplayers
setworldspawn
spawnpoint
spreadplayers
stats
stop
stopsound
summon
teleport
tell
tag[upcoming 1.13]
team[upcoming 1.13]
tellraw
testfor
testforblock
testforblocks
tickingarea
time
title
toggledownfall
tp
transferserver
trigger
weather
whitelist
worldborder
wsserver
Education Edition commands[edit | edit source]
List of Education Edition commands, some information were taken from Code Connection API.pdf and at the program folder of Minecraft: Windows 10 Edition.
| |
This section is a work in progress and needs your help |
| Additional research required. This section requires additional research.
|
| This section may need cleanup to comply with the style guide. Please help improve this if you can. The talk page may contain suggestions. |
Main[edit | edit source]
ability
clearfixedinv
executeasother
executeasself
getchunkdata
getchunks
geteduclientinfo
getspawnpoint
globalpause
immutableworld
querytarget
setfixedinvslot
setfixedinvslots
worldbuilder
Agent[edit | edit source]
attack
collect
createagent
destroy
detect
detectredstone
drop
dropall
getitemcount
getitemdata
getitemspace
inspect
inspectdata
move
place
till
tpagent
transfer
turn
Miscellaneous[edit | edit source]
classroommode
code
position
Removed commands[edit | edit source]
| This section contains content that is no longer in the game. These features only exist in outdated versions of Minecraft.
|
| Additional research required. This section requires additional research (August 27, 2015).
|
achievement
banip
broadcast
home
setspawn
solid
unban
Video[edit | edit source]
History[edit | edit source]
| Classic | |||||
|---|---|---|---|---|---|
| 0.0.15a_03 | Added /ban, /banip, /broadcast, /deop, /kick, /op, /tp, and /unban. | ||||
| 0.0.16a_01 | Changed /broadcast to /say. | ||||
| 0.0.17a | Added /setspawn. | ||||
| 0.0.20a | Added /solid. | ||||
| Indev | |||||
| 0.31 | All commands removed. | ||||
| Alpha | |||||
| 1.0.16 | Added /ban, /ban-ip, /banlist, /deop, /home, /kick, /op, /pardon, /pardon-ip, /say, and /stop. | ||||
| 1.0.16_01 | Added /save-all, /save-on, /save-off and /tp. | ||||
| 1.0.16_02 | Added /list and /tell. | ||||
| 1.2.5 | Removed /home. | ||||
| 1.2.6 | Added /kill. | ||||
| Beta | |||||
| 1.3 | Added /whitelist. | ||||
| Official release | |||||
| 1.3.1 | 12w16a | Added cheats mode and /gamemode, /give, /time, /toggledownfall, and /xp. | |||
| 12w17a | Added /help. | ||||
| 12w21a | Added /seed. | ||||
| 12w22a | Added /defaultgamemode. | ||||
| 12w24a | Added /publish. | ||||
| 12w25a | Cheats can now be turned on or off when opening a world to other players through LAN. | ||||
| 12w27a | Added /debug. | ||||
| 12w30a | /gamemode 3 change to /gamemode 0. | ||||
| 1.4.2 | 12w32a | Added /difficulty, /gamerule, /spawnpoint, and /weather.
| |||
| Added target selectors. | |||||
| 12w37a | Added /clear. | ||||
| 12w38a | Added item arguments to /clear. | ||||
| 12w41a | The limit for /xp is now 2,147,483,647 instead of 5,000. | ||||
| 1.4.4 | 1.4.4-pre | Added /enchant. | |||
| 1.5 | 13w03a | Added /testfor. | |||
| 13w04a | Added /scoreboard. | ||||
| 13w09b | Added /effect. | ||||
| 1.6.1 | 13w23a | Added /spreadplayers.
| |||
Added gamerule naturalRegeneration. | |||||
| 13w24a | Added gamerule doDaylightCycle. | ||||
| 13w24b | The damage dealt by /kill was changed from 1,000 to 3.4×1038. | ||||
| 1.6-pre | Added clear argument to /effect. | ||||
| 1.6.1-pre | Added /playsound. | ||||
| 1.7.2 | 13w36a | Added /summon.
| |||
Added /achievement.
| |||||
Added dataTag argument to /give. | |||||
| 13w37a | Added /setblock, /tellraw, and /testforblock. | ||||
| 13w38a | Added /setidletimeout. | ||||
| 13w43a | Added /setworldspawn. | ||||
| 1.8 | 14w02a | Added /blockdata.
| |||
Added the @e target selector variable.
| |||||
Added player|entity argument to /kill.
| |||||
Added data argument to /clear.
| |||||
Added dataTag argument to /testfor.
| |||||
/testfor is no longer exclusive to command blocks.
| |||||
Added insertion attribute to raw JSON text specification. | |||||
| 14w02c | To fix MC-44371, /kill now directly kills non-living targets, rather than dealing 3.4×1038 void damage. | ||||
| 14w03a | Added rotation arguments to /tp.
| ||||
Added dx, dy, and dz to target selector arguments.
| |||||
Added /clone and /fill.
| |||||
Added gamerule logAdminCommands.
| |||||
| NBT data now supports using string IDs rather than numerical IDs. | |||||
| Numerical IDs no longer work in other parts of commands, though they still work for NBT data. | |||||
| 14w04a | Added /particle. | ||||
| 14w05a | Added spectator to /gamemode and /defaultgamemode. | ||||
| 14w06a | Added hideParticles argument to /effect.
| ||||
Added /trigger. | |||||
| 14w07a | Added /execute and /testforblocks.
| ||||
/testfor can now test for partial NBT tag matches. | |||||
| 14w08a | Commands run using /execute now pass their success value back to the command block running them. | ||||
| 14w10a | Added gamerule showDeathMessages.
| ||||
Added force option to /clone. | |||||
| 14w17a | Added /worldborder.
| ||||
Added gamerule randomTickSpeed. | |||||
| 14w19a | Added /worldborder damage and /worldborder warning. | ||||
| 14w20a | Added /title.
| ||||
Added selector attribute to raw JSON text specification.
| |||||
Added move option to /clone. | |||||
| 14w26a | Added /worldborder add.
| ||||
Added /replaceitem.
| |||||
Added gamerule sendCommandFeedback | |||||
| 14w28a | Added /stats. | ||||
| 14w29a | Added /worldborder get.
| ||||
Added force argument to /particle.
| |||||
Added /time query.
| |||||
| Added the ability to create dummy gamerules. | |||||
Added QueryResults to /stats. | |||||
| 14w30a | /summon can now spawn lightning. | ||||
| 14w31a | /debug can be run in single player.
| ||||
Added chunk argument to /debug. | |||||
| 14w32b | Added /entitydata.
| ||||
/give can no longer make illegal stacks. | |||||
| 1.8.1 | 1.8.1-pre1 | Added the game rule doEntityDrops.
| |||
The game rule doTileDrops no longer affects entities. | |||||
| 1.9 | 15w37a | Added gamerule spectatorsGenerateChunks. | |||
| 15w43a | /gamemode now displays in chat the gamemode the player switched to. | ||||
| 15w49a | /playsound now accepts Tab to complete.
| ||||
Added player and params tag to the /particle | |||||
| 15w49b | /time query now accepts day as a value. | ||||
| 15w51a | Added gamerule spawnRadius. | ||||
| 16w02a | The m selector now accepts the standard literal gamemode values and abbreviations, such as a and adventure, and these may be negated as well.
| ||||
/playsound now requires a source parameter, specifying what is the sound's category for volume purposes.
| |||||
Running /help in a command block will now randomly use one of various different humorous phrases as the previous output. | |||||
| 16w03a | /achievement no longer affects statistics. | ||||
| 16w07a | Added gamerule disableElytraMovementCheck. | ||||
| 1.9.3 | pre1 | /tp will no longer teleport the player to a y-coordinate outside the range -512 to 512. | |||
| pre2 | Added /stopsound. | ||||
| 1.10 | 16w21b | The y-coordinate range of /tp is increased to -4096 to 4096. | |||
| 1.10-pre1 | Added /teleport, which is like /tp, except that the target parameter is mandatory, the 'teleport to other player' usage is unavailable, and the use of relative coordinates is relative to the executor of the command, rather than relative to the target. | ||||
| 1.11 | 16w32a | Added block state support to /execute, /fill, /setblock and /testforblock. | |||
| 16w32b | Added ability for /title to display text in the action bar position. | ||||
| 16w38a | Added gamerules doWeatherCycle and maxEntityCramming.
| ||||
Removed implicit target selectors (for example, @e[167,28,454]).
| |||||
Invalid target selectors (such as @e[Type=creeper], @e[asdf=nonexistent], and @e[malformed]) now generate an error instead of being silently ignored. | |||||
| 16w39a | Added /locate. | ||||
| 1.12 | 17w13a | Added /recipe and /advancement.
| |||
Added gamerule doLimitedCrafting.
| |||||
Removed /achievement. | |||||
| 17w16b | Added gamerule maxCommandChainLength.
| ||||
Added the @s target selector variable | |||||
| 17w18a | Added gamerule announceAdvancements. | ||||
Added /reload. | |||||
| 1.12-pre1 | Added gamerule gameLoopFunction. | ||||
Added /function. | |||||
| Upcoming | |||||
| 1.13 | 17w45a | Different components of commands are displayed in different colors, and errors will be displayed in red without having to run the command. | |||
| Commands, for the most part, do not allow uppercase letters, and are now much faster and more efficient. | |||||
An nbt argument in target selectors.
| |||||
| Changed the syntax for several commands. | |||||
Added /tag and /team.
| |||||
Removed /enchant, /stats, /testfor, /testforblock, /testforblocks and /toggledownfall.
| |||||
The syntax of /execute has been split off.
| |||||
/gamerule no longer accepts unknown values ("custom gamerules").
| |||||
Values to /gamerule are now type checked. | |||||
| 17w45b | Added /data.
| ||||
Removed /entitydata.
| |||||
Reworked /execute store. | |||||
| 17w46a | Added /datapack.
| ||||
| The player now has the option to toggle automatic command suggestions. | |||||
| The command UI has a new prototype, and now works in multiplayer. | |||||
| 17w47a | Removed /blockdata.
| ||||
Particle names have been changed for the command /particle.
| |||||
| Added an option in chat to toggle automatic command suggestions. | |||||
| 17w48a | Tweaked the command suggestion UI. | ||||
| Reworked tab-completion for coordinates. | |||||
| 17w49b | Removed the gameLoopFunction /gamerule. | ||||
| 17w50a | Local coordinates can now be specified in commands using ^.
| ||||
Tab-completing when not targeting a block will suggest ~ ~ ~. | |||||
| 18w01a | Added facing to /teleport, which will make the target entity face an entity or a location.
| ||||
Added the options noon and midnight to /time set. | |||||
| Pocket Edition Alpha | |||||
| 0.7.4 | Added support for commands, though none are implemented yet. | ||||
| 0.16.0 | build 1 | Added /clearfixedinv, /clone, /deop, /execute, /fill, /gamemode, /give, /help (with alias /?), /kill, /list, /op, /say, /setblock, /setfixedinvslot, /setworldspawn, /spawnpoint, /summon, /tell (with aliases /msg and /w), /testforblock, /testforblocks, /time, /toggledownfall, /tp (with alias /teleport), /weather, /wsserver and /xp.
| |||
Functionality of most commands is equivalent to Java Edition 1.10 usage. Differences include: no support for datatags, /clone cannot use forced cloneMode, /gamemode can only use Creative and Survival modes, the player target is optional in /give, and the entity target is optional in /execute. | |||||
| build 2 | Removed /clearfixedinv and /setfixedinvslot, along with other Education Edition -related items. | ||||
| build 5 | Added /enchant. | ||||
| Pocket Edition | |||||
| 1.0 | build 1 | Added /locate and /connect. | |||
| build 2 | Removed /locate. | ||||
| build 3 | Re-added /locate. Only works for strongholds. | ||||
| 1.0.3 | build 1 | Added /transferserver. | |||
| 1.0.5 | build 1 | Added /clear, /difficulty, /effect, /gamerule, /me, /particle, /playsound, /replaceitem, /spreadplayers, /stopsound, /testfor and /title. | |||
| build 2 | Removed /particle.
| ||||
The amplifier on /effect can no longer have negative values. | |||||
| 1.1 | build 1 | The canplaceon and candestroy are now supported for /replaceitem.
| |||
/locate can now find other structures.
| |||||
Added dodaylightcycle, doentitydrops, dofiretick, domobspawning, domobloot, dotiledrops, doweathercycle, keepinventory and mobgriefing gamerules. | |||||
| 1.1 | Added /setmaxplayers. | ||||
| Bedrock Edition | |||||
| 1.2 | build 1 | Added /tickingarea. | |||
Issues[edit | edit source]
Issues relating to “Commands” are maintained on the issue tracker. Report issues there.
See also[edit | edit source]
| Versions | |||||
|---|---|---|---|---|---|
| Development |
| ||||
| Technical |
| ||||
| Multiplayer | |||||
| Game customization | |||||
| Editions |
| ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Development | |||||||||||
| Technical | |||||||||||
| Multiplayer | |||||||||||
| Exclusive features |
| ||||||||||
| Removed | |||||||||||
