Commands

From Minecraft Wiki
Jump to: navigation, search
This article is about console commands. For the similar system found in the Legacy Console Edition, see host privileges.
Split-arrows.svg
This page is currently in the process of being split. [discuss]
See the talk page for more information about the split.

Commands, also known as console commands, are advanced features activated by typing certain strings of text.

Usage[edit]

In the client, commands are entered via the chat window, which is displayed by pressing the T / Chat button.png[BE & EE only] / D-Pad right[BE only], or, / key. Using the / key also enters the forward-slash that commands require as a prefix, so it is a useful shortcut. The and keys can be used to view previously entered text, including all previously executed commands. 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 the chat.

When the cursor is at a location corresponding to some types of argument (such as an ID), a list of applicable values appears above the text box. If the argument is already containing some characters, the list displays only those values containing the typed command/text.

Commands may also be entered in a multiplayer server's console, but are not preceded by a / when entered this way. A server owner 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 argument, like a player's username.

The majority of commands are available only in the following situations:

Some player commands are also available even when cheats are not enabled.

Note: In Java Edition, 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"). The player does not actually need to be on a LAN or have others join. This is not permanent but allows the use of commands until the player quits the world, and changes the player makes via commands (items spawned, etc.) are saved with the world. The player can do this each time the player starts playing the world again. Note that this disables game pausing for the duration, so while open to LAN, the player should get somewhere safe or reload their world before using the Game Menu. The player can disable the LAN world by reloading the world. To permanently enable cheats, the level.dat has to be edited.

In Bedrock Edition, cheats can be toggled at any time in the "Game" tab of the settings menu. Enabling cheats in a world permanently prevents players from unlocking achievements in that world, even if cheats are later turned off.

Relative world coordinates and Local coordinates[edit]

Main article: Coordinates

Target selectors[edit]

Main article: Target selectors

Data tags[edit]

Information icon.svg
This feature is exclusive to Java Edition. 
Main article: NBT format

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):

Data Structure Specification Links
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/concrete powder/anvils
Other entities firework rockets, paintings, and item frames

Raw JSON text[edit]

Main article: Raw JSON text format

The /tellraw and /title commands use the raw JSON text format to display texts.

Also, Some values of arguments in NBT structures are using JSON format.

Command guide[edit]

Syntax[edit]

In Java Edition:

Syntax Meaning
plain text Enter this literally, exactly as shown.
<argumentsName> An argument that should be replaced with an appropriate value.
[entry] This entry is optional.
(entry|entry) (Required) Pick one of the entries that is shown.
[entry|entry] (Optional) Pick one of the entries that is shown.
ellipsis ... Another sub-command is required.

In Bedrock Edition:

Syntax Meaning
plain text Enter this literally, exactly as shown.
name: type An argument that should be replaced with an appropriate value.
entry|entry Pick one of the entries that is shown.
<entry> This entry is required.
[entry] This entry is optional.

ID arguments in Java Edition[edit]

Information icon.svg
This feature is exclusive to Java Edition. 

Many commands have arguments that identify particular types of blocks, items, entities, advancements, bossbars, effects, enchantments and so on. 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. These IDs all have namespaces. All original Minecraft contents are namespaced minecraft while contents from mods or data packs have other namespaces. Namespace prefix of IDs namespaced minecraft can be omitted for most situations; however, in certain cases, such as NBT data tag matching, full namespaced ids are required.

<block>[edit]

A single <block> argument looks like this:

  • stone
  • minecraft:redstone_wire[power=15,north=up,south=side]
  • minecraft:jukebox{RecordItem:{...}}
  • minecraft:furnace[facing=north]{BurnTime:200}

The format of <block> parameters is namespaced_ID[block_states]{data_tags}, in which block states and data tags can be omitted when they are not needed.

  • Namespaced ID is required (though if namespace isn't set it defaults to minecraft:).
    • In the context of "conditions"/testing for blocks, it can also be the namespace ID of block tag with the prefix of #, such as #minecraft:planks.
  • Block states are inside [], comma-separated and must be properties/values supported by the blocks. They are optional.
    • minecraft:stone[doesntexist=purpleberry] is a syntax error, because stone doesn't have doesntexist.
    • minecraft:redstone_wire[power=tuesday] is a syntax error, because redstone_wire's power is a number between 0 and 15.
  • Data tags are inside {}. It's optional.
  • In the context of "conditions"/testing for blocks, only the states provided are tested.
    • If command tests redstone_wire[power=15], it checks only power, but ignores other states such as north.
  • In the context of setting blocks, any states provided are set, but anything omitted retain their default values, depending on the block.
    • If command sets redstone_wire[power=15], it is set power to 15, but north is a default value (in this case, set to none).

<item>[edit]

A single <item> argument that looks like this:

  • stone
  • minecraft:stick{display:{Name:"\"Stick of Untruths\""}}

The format of <item> parameters is namespaced_ID{data_tags}, in which data tags can be omitted when not needed.

  • Namespaced ID is required (though if namespace isn't set it defaults to minecraft:).
  • Data tags are inside {}. It's optional.

List of argument types[edit]

Main article: Argument types

These are the argument types.

Success Conditions[edit]

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 a 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[edit]

Describes restrictions on who can use the command or in what context.
  • None: The command has no restriction.
  • Cheat only[Bedrock Edition only]: When executed by a player, the command is available only if cheats is enabled.
    • In Bedrock Edition, when cheats is disabled, these commands can't be used by players even if they have a high permission level. In Java Edition, if players have a high enough permission level, they can use corresponding commands no matter whether cheats is allowed.
  • Dedicated server only: The command is available only on a dedicated server.
  • No command blocks: The command cannot be executed by a command block.

Permission level[edit]

Permission level is used to describe permissions on what commands can be used by an executor. For example, in Bedrock Edition, /setmaxplayers can't be executed in a command block, because this command requires executor to have permission of level 3, while command blocks have permission of only 1 level.
In Java Edition, permission level can be 0, 1, 2, 3, and 4.
  • A command block or a minecart with command block has permission level of 2.
  • The console of a server has permission level of 4.
  • A function has permission level of 2 (but it can be changed in server.properties).
  • For a player:
    • If the player is an op in dedicated server, their permission level is specified in ops file.
    • If the player is in a singleplayer world or is the owner of a LAN world, and cheat is enabled, permission level is 4.
    • If the player is in a cheat-allowed LAN world, permission level is 4.
    • Otherwise, permission level is 0.
In Bedrock Edition, permission level can be 0, 1, 2, 3, and 4.
  • A command block or a minecart with command block has permission level of 1.
  • The console of a server has permission level of 4.
  • A function as well as a script in Add-ons has permission level of 1.
  • For a player:
    • If in dedicated server, the player's "Operator Commands" option is enabled in the "Player Permission" screen, their permission level is 1 by default (which can be changed in server.properties).
    • If in a singleplayer world or a LAN world, the player's "Operator Commands" option is enabled in the "Player Permission" screen, permission level is 3.
    • Otherwise, the player's permission level is 0.[needs testing]
Note that command permission level differs from permission level in pause menu screen and "Player Permission" screen in Bedrock Edition, which includes Visitor/Member/Operator/Custom. However, operator in singleplayer world must have command permission level of 3, because its Operator Commands is enabled. Similarly, visitors and members have a command permission level of 0.

List and summary of commands[edit]

The table below summarizes all commands, including upcoming ones.

Summary of Commands
Command Description BE EE JE JE OP level BE&EE OP level MP only
/? An alias of /help. Provides help for commands. Yes Yes Yes 0 0
/ability Grants or revokes a player ability. Yes Yes 1
/advancement Gives, removes, or checks player advancements. Yes 2
/agent Controls the agent. Yes Yes 0‌[EE only]
1‌[BE only]
/allowlist Manages the server's allowlist. Yes 4
/alwaysday An alias of /daylock. Locks and unlocks the day-night cycle. Yes Yes 1
/attribute Queries, adds, removes or sets an entity attribute. 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
/bossbar Creates and modifies bossbars. Yes 2
/camerashake Used to enable a camera shaking effect. Yes 1
/changesetting Changes a setting on the dedicated server while it's running. Yes 4 MP
/classroommode Ability to edit restricted blocks. Yes 0
/clear Clears items from player inventory. Yes Yes Yes 2 1
/clearspawnpoint Remove spawnpoints in the world. Yes 1
/clone Copies blocks from one place to another. Yes Yes Yes 2 1
/closechat Closes the chat window of the local player if it is open. Yes 0
/closewebsocket Closes websocket connection if there is one. Yes Yes 0
/code Launches Code Builder. Yes 0
/codebuilder Sets Code Builder state for a player. Yes 1
/connect An alias of /wsserver. Attempts to connect to the websocket server. Yes Yes 0‌[EE only]
2‌[BE only]
/data Gets, merges, modifies and removes block entity and entity NBT data. Yes 2
/datapack Controls loaded data packs. Yes 2
/daylock An alias of /alwaysday. Locks and unlocks the day-night cycle. Yes Yes 1
/debug Starts or stops a debugging session. Yes 3
/dedicatedwsserver Attempts to connect to the websocket server. Yes 0 MP
/defaultgamemode Sets the default game mode. Yes 2
/deop Revokes operator status from a player. Yes Yes Yes 3 2 MP‌[Java Edition only]
/dialogue Opens NPC dialogue for a player. Yes 1
/difficulty Sets the difficulty level. Yes Yes Yes 2 1
/effect Add or remove status effects. Yes Yes Yes 2 1
/enableencryption Enable encryption for the current websocket connection. Yes Yes 0
/enchant Adds an enchantment to a player's selected item. Yes Yes Yes 2 1
/event Used to trigger an event on an entity. Yes 1
/execute Executes another command. Yes Yes Yes 2 1
/experience An alias of /xp. Adds or removes player experience. Yes 2
/fill Fills a region with a specific block. Yes Yes Yes 2 1
/fog Used for managing active fog settings for players. Yes 1
/forceload Forces chunks to constantly be loaded or not. Yes 2
/function Runs a function. Yes Yes Yes 2 1
/gamemode Sets a player's game mode. Yes Yes Yes 2 1
/gamerule Sets or queries a game rule value. Yes Yes Yes 2 1
/gametest To test the GameTest features. Yes 1
/getchunkdata Gets pixels for a specific chunk. Yes Yes 3
/getchunks Gets list of chunks that are loaded. Yes Yes 3
/geteduclientinfo Shows the information about the client. Yes 0
/geteduserverinfo Shows the information about the server. Yes 0 MP
/getlocalplayername Shows the name of the local player. Yes Yes 0
/getspawnpoint Gets the spawn position of the specified player(s). Yes Yes 3
/gettopsolidblock Gets the position of the top non-air block below the specified position. Yes Yes 0‌[EE only]
1‌[BE only]
/give Gives an item to a player. Yes Yes Yes 2 1
/globalpause Sets or gets the paused state of the game for all players. Yes Yes 3
/help An alias of /?. Provides help for commands. Yes Yes Yes 0 0
/immutableworld Allows setting immutable state of a world. Yes Yes 1
/item Manipulates items in inventories. Yes 2
/kick Kicks a player off a server. Yes Yes Yes 3 1
/kill Kills entities (players, mobs, items, etc.). Yes Yes Yes 2 1
/lesson Handle Educational Lesson reporting. Yes 0
/list Lists players on the server. Yes Yes Yes 0 0
/listd Lists the information about players on the server. Yes Yes 3
/locate Locates closest structure. Yes Yes Yes 2 1
/locatebiome Locates closest biome. Yes 2
/loot Drops items from an inventory slot onto the ground. Yes 2
/me Displays a message about the sender. Yes Yes Yes 0 0
/mobevent Enables/disables a specified mob event. Yes Yes 1
/msg An alias of /tell and /w. Displays a private message to other players. Yes Yes Yes 0 0
/music Allows the player to control playing music tracks. Yes 1
/op Grants operator status to a player. Yes Yes Yes 3 2 MP‌[Java Edition only]
/ops An alias of /permission. Reloads and applies permissions. Yes Yes 4 MP
/pardon Removes entries from the banlist. Yes 3 MP
/pardon-ip Removes entries from the banlist. Yes 3 MP
/particle Creates particles. Yes Yes Yes 2 1
/perf Captures info and metrics about the game for 10 seconds. Yes 4 MP
/permission An alias of /ops. Reloads and applies permissions. Yes Yes 4 MP
/playanimation Used to run a one-off animation. Yes 1
/playsound Plays a sound. Yes Yes Yes 2 1
/publish Opens single-player world to local network. Yes 4 SP only
/querytarget Gets transform, name, and id information about the given target entity or entities. Yes Yes 0‌[EE only]
2‌[BE only]
/recipe Gives or takes player recipes. Yes 2
/reload Reloads loot tables, advancements, and functions from disk. Yes Yes Yes 2 2
/remove Removing agent. ? 2
/replaceitem Replaces items in inventories. Yes Yes Removed 2 1
/ride Used to make entities ride other entities, stop entities from riding, make rides evict their riders, or summon rides or riders. Yes 1
/save Prepares a backup, queries its status, or resumes. Yes 4 MP
/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 2 1
/schedule Delays the execution of a function. Yes Yes 2 1
/scoreboard Manages scoreboard objectives and players. Yes Yes Yes 2 1
/seed Displays the world seed. Yes 0 in singleplayer
2 in multiplayer
/setblock Changes a block to another block. Yes Yes Yes 2 1
/setidletimeout Sets the time before idle players are kicked. Yes 3 MP
/setmaxplayers Sets the maximum number of players allowed to join. Yes Yes 3
/setworldspawn Sets the world spawn. Yes Yes Yes 2 1
/spawnitem Spawns an item entity at position. Yes 0
/spawnpoint Sets the spawn point for a player. Yes Yes Yes 2 1
/spectate Make one player in spectator mode spectate an entity. Yes 2
/spreadplayers Teleports entities to random locations. Yes Yes Yes 2 1
/stop Stops a server. Yes Yes 4 4 MP
/stopsound Stops a sound. Yes Yes Yes 2 1
/structure Used to save and load structures without having to use structure blocks items in inventories. Yes 1
/summon Summons an entity. Yes Yes Yes 2 1
/tag Controls entity tags. Yes Yes Yes 2 1
/takepicture Takes a photo of a player or from a player's point of view. Yes Yes 1
/team Controls teams. Yes 2
/teammsg An alias of /tm. Specifies the message to send to team. Yes 0
/teleport An alias of /tp. Teleports entities. Yes Yes Yes 2 1
/tell An alias of /msg and /w. Displays a private message to other players. Yes Yes Yes 0 0
/tellraw Displays a JSON message to players. Yes Yes Yes 2 1
/testfor Counts entities matching specified conditions. Yes Yes Removed 2 1
/testforblock Tests whether a block is in a location. Yes Yes Removed 2 1
/testforblocks Tests whether the blocks in two regions match. Yes Yes Removed 2 1
/tickingarea Add, remove, or list ticking areas. Yes Yes 1
/time Changes or queries the world's game time. Yes Yes Yes 2 1
/title Manages screen titles. Yes Yes Yes 2 1
/titleraw Controls screen titles with JSON messages. Yes Yes 1
/tm An alias of /teammsg. Specifies the message to send to team. Yes 0
/toggledownfall Toggles the weather. Yes Yes Removed 1
/tp An alias of /teleport. Teleports entities. Yes Yes Yes 2 1
/trigger Sets a trigger to be activated. Yes 0
/videostream Attempts to connect to the websocket server to send a video stream. Yes 0
/w An alias of /tell and /msg. Displays a private message to other players. Yes Yes Yes 0 0
/wb An alias of /worldbuilder. Ability to edit restricted blocks. Yes Yes 1
/weather Sets the weather. Yes Yes Yes 2 1
/whitelist Manages server whitelist. Removed Yes 3 MP
/worldborder Manages the world border. Yes 2
/worldbuilder An alias of /wb. Ability to edit restricted blocks. Yes Yes 1
/wsserver An alias of /connect. Attempts to connect to the websocket server. Yes Yes 0‌[EE only]
2‌[BE only]
/xp An alias of /experience[Java Edition only]. Adds or removes player experience. Yes Yes Yes 2 1

Removed commands[edit]

Summary of Commands
Command Description Version Removed Reason for Deletion BE EE JE JE OP level BE&EE OP level MP Only
/achievement Gives or takes an achievement from a player Java Edition 1.12
(17w13a)
Achievements were superseded by advancements Removed 2
/banip Bans a player by IP number Java Edition Indev 0.31 Superseded by /ban-ip Removed ? MP
/blockdata Modifies the data tag of a block Java Edition 1.13
(17w47a)
Superseded by /data Removed 2
/broadcast Broadcasts a message across the entire server Java Edition Classic 0.0.16a_01 Superseded by /say Removed 1
/chunk Force chunks to load constantly or not Java Edition 1.13.1-pre1 Superseded by /forceload Removed 2
/clearfixedinv Clears fixed inventory slots Pocket Edition v0.16.0 alpha
(build 2)
? Removed Removed ? ?
/detect Execute a command when condition is met. Bedrock Edition 1.2.0 Superseded by /execute Removed 1
/entitydata Modifies the data tag of an entity Java Edition 1.13
(17w45b)
Superseded by /data Removed 2
/executeasself Execute a command. ? ? Removed Removed 0
/home Teleports player to the world spawn Java Edition Alpha v1.2.5 World spawn became based on spawn chunks instead of a singular location Removed 0
/position Toggles player coordinates to be displayed on the HUD. Education Edition 1.0.21 Superseded by /gamerule Removed 0
/mixer Mixer interactivity control. Bedrock Edition 1.16.210 Mixer discontinued Removed 0
/replaceitem Replaces items in inventories. Java Edition 1.17
(20w46a)
Superseded by /item Available Available Removed 2
/resupply Update the villagers' supply for economic trade. ? ? Removed 2
/setfixedinvslot Sets fixed inventory slot with a specific item. Pocket Edition v0.16.0 alpha
(build 2)
? Removed Removed ? ?
/setfixedinvslots Sets the amount of fixed inventory slots Pocket Edition v0.16.0 alpha
(build 2)
? Removed Removed ? ?
/setspawn Sets the current location as the default spawn location for new players Java Edition Indev 0.31 World spawn became based on spawn chunks instead of a singular location Removed 2
/solid Toggles between placing stone and placing bedrock Java Edition Indev 0.31 Placing blocks became inventory based Removed 2
/stats Update objectives from command results Java Edition 1.13
(17w45a)
Merged with /execute Removed 2
/toggledownfall Toggles the weather Java Edition 1.13
(17w45a)
Redundancy with /weather Available Available Removed 2
/transferserver Transfer player to a server. Bedrock Edition 1.2.3 ? Removed Removed ?
/unban Pardons a banned player Java Edition Alpha v1.0.16 Superseded by /pardon Removed 3 MP

Others[edit]

Developer commands[edit]
Main article: developer commands
Information icon.svg
This feature is exclusive to Bedrock Edition and Education Edition. 

Developer commands are only enabled in the development and testing environment of the game. In release versions, players cannot see and execute these commands.

Agent commands[edit]
Hydrogen.png
This section describes an education-related feature. 
This feature is available only in Education Edition or when enabling the "Education Edition" option in Bedrock Edition.

Superseded by /agent

History[edit]

This section is missing information about Bedrock Edition and Education Edition info. 
Please expand the section to include this information. Further details may exist on the talk page.
Java Edition Classic
0.0.15a (Multiplayer Test 3)Added commands.
Java Edition Indev
0.31?Removed all commands.
Java Edition Alpha
v1.0.16Re-added several commands.
Java Edition
1.3.112w16aAdded cheats mode.
12w25aCheats can now be turned on or off when opening a world to other players through LAN.
1.814w03aNBT 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.
1.1116w32aAdded block state support to commands.
1.1317w45aA new library named Brigadier is now used to parse commands. Different components of commands are displayed in different colors, and errors are 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.
17w46aThe player now has the option to toggle automatic command suggestions.
The command UI has a new prototype, and now works in multiplayer.
17w47aAdded an option in chat to toggle automatic command suggestions.
17w48aTweaked the command suggestion UI.
Reworked tab-completion for coordinates.
17w50aLocal coordinates can now be specified in commands using ^.
Tab-completing when not targeting a block suggests ~ ~ ~.
18w01aChanged all custom names (blocks, items, entities, block entities) to translatable text components.
Thrower and Owner nbt keys of item entities are no longer strings, but are instead compounds with two longs named L and M.
owner nbt key of snowballs, eggs and ender pearls are no longer strings, but are instead compounds with two longs named L and M.
18w02aErrors during a command are now a nicer error message (with a tool tip for more info).
Server commands now run from world spawn in the Overworld, instead of at 0,0,0.
18w03aImproved performance of command parsing and command execution.
18w05aAdded basic entity selector suggestions in the command UI.
A warning is now logged for ambiguous commands.
18w06aAdded command suggestions for entity selectors.
Whitespaces are now allowed in entity selectors & block state arguments.
September 26, 2018Brigadier open-sourced under the MIT license. (Source code previously was available on the library site, with no license specified).
1.1620w06aAdded /locatebiome.
20w17aAdded /attribute.
1.1720w46aRemoved /replaceitem. Replaced with /item replace.
Pocket Edition Alpha
v0.7.4Added support for commands, though none are implemented yet.
v0.16.0build 1Added commands.
Functionality of most commands is equivalent to Java Edition 1.10 usage. Differences include: no support for data tags.
Bedrock Edition
1.2.0?A new command parsing system is now used.

Issues[edit]

Issues relating to "Commands" are maintained on the bug tracker. Report issues there.

See also[edit]

References[edit]