Commands

From Minecraft Wiki
Jump to navigation Jump to search
This article is about console commands. For the similar system found in the Legacy Console Edition, see host privileges.

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

Usage[edit | edit source]

In the client, commands are entered via the chat window, which is displayed by pressing the T / [BE 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 Up and Down keys can be used to view previously entered text, including all previously executed commands.

When the cursor is at a location corresponding to some types of argument (such as an entity 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 text. Pressing Tab while entering commands cycles through possible commands or arguments, and can be used to auto-enter them.

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 can be executed in the following ways;

Command guide[edit | edit source]

Syntax[edit | edit source]

In Java Edition:

Entry Meaning
plain text Enter this literally, exactly as shown.
<argumentName> An argument, which should be replaced with an appropriate value.
Decorator Meaning
[entry] This entry is optional.
(entry|entry)
(entry|entry|entry)
etc.
Required. Pick one of these entries.
[entry|entry]
[entry|entry|entry]
etc.
Optional. Pick one of these entries.
ellipsis ... In the game, another full command is required.
In this wiki, some required parts are left out.
For example: [<size>] is an optional argument. [size] is an optional plain text.
For example: advancement (grant|revoke) <targets> only <advancement> [<criterion>], where advancement and only are plain texts that should be entered literally; (grant|revoke) means we should pick one plain text from grant and revoke; <targets> and <advancement> are required arguments, which should be replaced with appropriate values; [<criterion>] is an optional argument.

In Bedrock Edition:

Entry Meaning
plain text Enter this literally, exactly as shown.
name: type An argument, which should be replaced with an appropriate value.
command: command Another full command is required.
plain text|plain text
(plain text|plain text|plain text)
etc
Enter one of these texts literally.
Decorator Meaning
<entry> This entry is required.
[entry] This entry is optional.
ellipsis ... In this wiki, some required parts are left out.
The angle bracket decorator (<entry>) cannot be applied on a plain text. A required plain text does not need any decorator.
For example, both set and <set> represent a required plain text, but the latter one is not used usually. <size: int> is a required argument.

In both Java Edition and Bedrock Edition, square bracket decorator ([entry]) mean that an entry is optional. Entries decorated with square brackets can only be at the end of a command. Multiple entries decorated with square brackets are allowed at the end of a command, for example, a [b] [c] at the end of a command indicates that only a, a b, and a b c are valid.

Restrictions[edit | edit source]

Most commands require the executor have a high enough permission level. That means most commands are available in the singleplayer world only if cheats are enabled, and available in multiplayer server only if the player is an operator. See permission level for details.

Some commands have restrictions on who can use the command or in what context.

  • None: The command has no restriction.
  • Cheats only[BE only]: Applicable only to Bedrock Edition. When executed by the server, or a script, the command is available no matter whether cheats are enabled. (Commands from the console, a scheduled function, a ticking function, or a WebSocket server connected with the dedicated server are executed by the server.) When executed in other ways, the command is available only if cheats are enabled. When cheats are disabled, these commands can't be used unless executed by a server or a script, even if the executor has a high permission level.
    • In Java Edition, if s executor has a high enough permission level, it can use corresponding commands regardless of whether cheats are allowed.
  • Dedicated server only: The command is available only on a dedicated server.
  • Singleplayer only: The command is not available on a dedicated server.

Cheats[edit | edit source]

Cheats can be enabled when creating a new world by Allow Commands‌[Java Edition only] / Cheats‌[Bedrock Edition only] options.

In Java Edition, the "Allow Commands" option when creating a new world only affects the player in a singleplayer world or the owner of a LAN world. The "Allow Commands" option when opening a LAN world affects all players in the LAN world.

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 file has to be edited.

In Bedrock Edition, cheats can be toggled at any time in the "Cheats" 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. In BDS, /changesetting command can be used to toggle cheats.

Result[edit | edit source]

After trying to run a command, it produces a certain result. There are various possible results, including "Unparseable", "Failed", "Successful", "Void"‌[JE only], "Terminated"‌[JE only], and "Error"‌[JE only].

Unparseable
If the entered command is incomplete or any argument cannot be parsed by the server, the command is unparseable.
If an argument cannot be parsed by the server, in this wiki we often describe it as being specified incorrectly.
When typing an argument into the chat, it's noticeable if an argument is specified incorrectly in Java Edition.
In Java Edition, if specified incorrectly, the argument is marked red and a syntax error message is displayed.
In Bedrock Edition, when typing in chat bar, if an argument can be parsed by the client, the next argument in syntax hint turns to white from gray. If all arguments (including optional arguments) are entered and parseable by the client, the whole syntax hint turns to gray from white. However, being able to be parsed by the client doesn't guarantee that this argument is parseable by the server.
In Java Edition, it behaves in the same way as typing in the chat when typing in a command block.
In Bedrock Edition, when entering into a command block, if the command is unparseable, a syntax error message is outputted into its output box when closing the command block screen.
When trying to execute an unparsable command, an error message is displayed.
In Java Edition, it is "Unknown or incomplete command" or "Incorrect argument for command".
In Bedrock Edition, it is "Unknown command" or "Syntax error: unexpected ... at ...".
If any command in a function file is unparseable, the function is unable to be loaded by the game.
In Bedrock Edition, if a command in a script is unparseable, an error is thrown when trying run the command.
Error‌[JE only]
If an error occurs with a command, it means that there's a noticeable bug on the command.
Technically, it means an exception other than brigadier.exceptions.CommandSyntaxException is thrown during execution.
Void‌[JE only]
Exclusive to /function command. When it is void, the command has no result or success value that can be stored by /execute store.
Terminating‌[JE only]
Exclusive to /execute command. When running a /execute command, if the number of execution branches becomes 0, the command terminates, ending before the last sub-command is executed.
For example: /execute as @s run ... in a command block.
Failed and Successful
If a command is not unparseable, erroring, void, nor terminating, it may be failed or successful.
If the Success Count is not less than 0, the command is failed. Otherwise, the command is successful.
The Success Count can be read by a redstone comparator from a command block or a script‌[Bedrock Edition only].
In Java Edition, if the command cannot be executed by command blocks, it has no Success Count. It is failed when /execute store success ... run ... stores 0, and successful when /execute store success ... run ... stores 1.
In Bedrock Edition, if the command cannot be executed by command blocks or scripts, it still has a Success Count, but cannot be obtained.
Note that when we say whether a command is failed or successful, it must not be unparseable, erroring, void, or terminating. Though when unparseable, erroring, void or terminating, the Success Count is 0, it is not considered as being failed nor successful.
Note that not all "successful" commands actually do something, and not all "failed" commands fail to do something useful.

List and summary of commands[edit | edit source]

The tables below summarizes all commands.

Available in Java Edition[edit | edit source]

Debugging commands[edit | edit source]

Debugging commands are only enabled in internal development builds of Java Edition, and are not normally accessible in release versions.

Available in Bedrock Edition and Education[edit | edit source]

Hidden commands[edit | edit source]

This feature is exclusive to Bedrock Edition and Minecraft Education. 

These commands are unavailable in general cases. Most of them can be accessed with a Websocket Server, NPC, or the Scripting API. Note: You can easily check if a command is still in the game by typing in /help <name of the command>, if you do this and it says syntax error then the command does not exist, if it either gives help on the command or says unknown command then it is still in the game, for example the command /help gettopsolidblock will return Unknown command: gettopsolidblock. Please check that the command exists and that you have permission to use it., while the command /help something will return Syntax error: Unexpected "something" at "/help >>something<<".

Removed commands[edit | edit source]

Removed from Java Edition[edit | edit source]

Removed from Bedrock Edition or Education[edit | edit source]

Other removed commands[edit | edit source]

Developer commands[edit | edit source]
Main article: Developer commands
This feature is exclusive to Bedrock Edition. 

Developer commands are only enabled in internal development builds of Bedrock Edition, and are not normally accessible in release versions.

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

Superseded by /agent

Joke commands[edit | edit source]

This feature is exclusive to Java Edition. 

These commands only exist in April Fools' Day joke versions of the game.

History[edit | edit source]

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.
This section is a work in progress. 
Please help expand and improve it. The talk page may contain suggestions.

Command additions and changes[edit | edit source]

Java Edition Classic
0.0.16aAdded commands /broadcast, /ban, /banip, /kick.
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.9.3pre2Added /stopsound.
1.1116w32aAdded block state support to commands.
16w39aAdded /locate.
1.1217w13aAdded /advancement and /recipe.
Removed /achievement.
17w18aAdded /reload.
pre1Added /function.
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.
17w45bAdded /data.
17w46aAdded /datapack.
The 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 /bossbar.
Added 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.1418w43aAdded /drop and /schedule.
18w45aRenamed /drop to /loot.
19w02aAdded /teammsg and /tm.
1.1519w41aAdded /spectate.
1.1620w06aAdded /locatebiome.
20w17aAdded /attribute.
1.1720w46aRemoved /replaceitem. Replaced with /item replace.
1.1821w37aAdded /jfr.
1.18.222w03aAdded /placefeature.
1.19Deep Dark Experimental Snapshot 1Added /warden_spawn_tracker.
22w11aDisabled access to /warden_spawn_tracker.
22w18aRemoved /placefeature. Replaced with /place feature.
22w19aRemoved /locatebiome. Replaced with /locate biome.
Finding structures from /locate now uses /locate structure.
1.19.322w46aAdded /fillbiome.
1.19.423w03aAdded /ride.
23w06aAdded /damage.
1.2023w16aAdded /return.
1.20.223w31aThe last 50 commands sent in chat is now remembered across game sessions, and can be accessed via up and down arrow keys.
Recent commands are now stored in command_history.txt in the .minecraft folder.
Added /random.
1.20.323w43aAdded /tick.
1.20.524w04aAdded /transfer.
Renamed "Allow cheats" to "Allow commands".
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.
Pocket Edition
1.0.0alpha 0.17.0.1Added /locate, /connect, and /fly.
alpha 0.17.0.2Removed /locate.
alpha 1.0.0.0Re-added /locate, currently can locate strongholds only.
1.0.5alpha 1.0.5.0Added more commands.
1.1.0alpha 1.1.0.0Added dodaylightcycle, doentitydrops, dofiretick, domobspawning, domobloot, dotiledrops, doweathercycle, keepinventory and mobgriefing to /gamerule.
CanPlaceOn and CanDestroy are now in /replaceitem and /give.
/locate can now find other structures.
alpha 1.1.0.3Added /setmaxplayers.
Bedrock Edition
1.2.0?A new command parsing system is now used.
beta 1.2.0.2Added /tickingarea.
/summon can now summon projectiles.
beta 1.2.0.31Coordinates are now a gamerule to /gamerule.
1.5.0
Added /ability, /immutableworld, and /worldbuilder.
1.6.0beta 1.6.0.6doInsomnia is now a gamerule to /gamerule.
1.7.0beta 1.7.0.2Added /scoreboard.
commandblocksenabled is now a gamerule to /gamerule.
1.8.0beta 1.8.0.8randomtickspeed is now a gamerule to /gamerule.
Added /particle and /reload.
showcoordinates dofiretick tntexplodes domobloot naturalregeneration dotiledrops and pvp no longer require cheats when using /gamerule.
1.9.0beta 1.9.0.0immediateRespawn and showDeathMessages are now a gamerule to /gamerule.
Added more particles (View all) to /particle.
Added /tellraw.
1.11.0beta 1.11.0.3Added /mobevent.
1.12.0beta 1.12.0.2spawnradius, sendcommandblockfeedback, maxcommandchainlength and commandblockoutput are now gamerules to /gamerule.
Added more particles (View all) to /particle.
1.14.0showtags is now a gamerule to /gamerule.
1.16.0Added /kick.
/spawnpoint can now be used in the nether.
1.16.100beta 1.16.100.52Added /playanimation, /ride, and /structure.
beta 1.16.100.54Added /fog.
beta 1.16.100.57Added /camerashake, /clearspawnpoint, and /event.
beta 1.16.100.58Added /music.
beta 1.16.100.59Added /schedule.
/camerashake now have two types of shakes.
beta 1.16.100.60/structure can now animate the placement of a structure.
1.16.210beta 1.16.210.53freezeDamage is now a gamerule to /gamerule.
/clone, /fill, and /setblock now have a new slash command options for passing in a list of block states to set on the block being spawned.
Removed /mixer.
beta 1.16.210.54You can now stop camera shaking in /camerashake.
Re-added /mixer.
You can now delete structures in /structure.
beta 1.16.210.58Removed /mixer again.
beta 1.16.210.60Added /gametest.
1.17.10beta 1.17.10.22Added /dialogue.
1.17.30beta 1.17.20.20respawnBlocksExplode is now a gamerule to /gamerule.
1.18.0beta 1.18.0.21Added /loot.
beta 1.18.0.22Removed /loot.
1.18.10beta 1.18.10.21Re-added /loot.
beta 1.18.10.26Added /damage.
1.18.30beta 1.18.20.21Added /volumearea.
1.19.0beta 1.19.0.30Added /script.
1.19.10Preview 1.19.10.23/locate can now find biomes.
1.19.60Preview 1.19.60.22Added /scriptevent.
1.19.80Preview 1.19.80.20Added command suggestions for block states.
1.19.80Preview 1.19.80.21Added /inputpermission.
1.20.0Preview 1.20.0.22Added /camera.
1.20.10Preview 1.20.10.21Added /recipe.
1.20.30Preview 1.20.30.22Added /transfer.
1.20.60
Experiment
Upcoming Creator Features
Preview 1.20.60.23Added /hud behind the "Upcoming Creator Features" experimental toggle.

April Fools commands[edit | edit source]

Java Edition
20w14∞Added /debugdim and /warp.
23w13a or bAdded /transform and /vote.

Issues[edit | edit source]

Issues relating to "Commands" are maintained on the bug tracker. Issues should be reported and viewed there.

See also[edit | edit source]

External links[edit | edit source]

Navigation[edit | edit source]

  1. bedrock samples for 1.20.80.5 release metadata/command_modules/mojang-commands.json line 15868
  2. bedrock samples for 1.20.80.5 release metadata/command_modules/mojang-commands.json line 15874
  3. bedrock samples for 1.20.80.5 release metadata/command_modules/mojang-commands.json line 15886