Commands

Commands, also known as console commands and slash commands, are advanced features activated by typing certain strings of text.
== Usage ==
In the client, commands are entered via the chat window, which is displayed by pressing the / / 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.
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. Pressing 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;
* Entered by a player in the chat window.
* Executed by a command block or Minecart with command block.
* In functions, as part of a data pack[Java Edition only] or behavior pack[Bedrock Edition only].
* In a multiplayer server, entered in the console.
* Click a Json text that has "run_command" action.
* Executed with a WebSocket server.
* Executed by an NPC.
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.
=== Enabling cheats in existing worlds ===
, 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 ( → "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. 
, 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.
== Command guide ==
=== Syntax ===
: 
:
Syntax	Meaning
 	Enter this literally, exactly as shown.
 	An argument that should be replaced with an appropriate value.
 	This entry is optional.
 	(Required) Pick one of the entries that is shown.
 	(Optional) Pick one of the entries that is shown.
 	Another sub-command is required.
: 
:
Syntax	Meaning
 	Enter this literally, exactly as shown.
 	An argument that should be replaced with an appropriate value.
 	Pick one of the entries that is shown.
 	This entry is required.
 	This entry is optional.
 	Another sub-command is required.
=== Restrictions ===
: Some commands have restrictions on who can use the command or in what context.
:*None: The command has no restriction.
:* Cheat only: When executed by a player, the command is available only if cheats is enabled.
:** , when cheats is disabled, these commands can't be used by players even if they have a high permission level. , if players have a high enough permission level, they can use corresponding commands regardless of whether cheats are allowed.
:* Dedicated server only: The command is available only on a dedicated server.
:* Creative Only: When executed by a player, the command is available only if player is in Creative.
=== Result ===
After trying to run the command comes different results, including "unparseable", "failed", "successful", "error", and "Terminate".
;Unparseable
:If the entered command is incomplete or the arguments do not meet required argument types, the command is unparseable.
:When typing a argument into the chat bar, it's noticeable if an argument does not meet the required argument type .
::, if not meet, the argument is marked red and an syntax error message is displayed.
::, when typing in chat bar, if an argument can be identified by client, the next argument in grammar hints turns white from gray. If all arguments (including optional arguments) are entered, the whole grammar hint turns gray from white. However, being able to be identified by client doesn't guarantee that this argument meet required argument type.
:, it behaves the same as typing in the chat bar when typing in a command block.
:, when entering into a command block, if the command is unparseable, an syntax error message is outputted into its output box after closing the command block screen.
:When trying to execute an unparsable command, an error message is displayed.
::, it is "Unknown or incomplete command" or "Incorrect argument for command".
::, it is "Unknown command" or "Syntax error: unexpected ... at ...".
:If a command in a function file is unparseable, the function is unable to loaded in game.
;Failed and successful
: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.
;Error
:If an error occurs with the command, it means that there's a noticeable bug on this command.
;Terminate
:When running a command, if the subcommands specifies 0 execution context, the command does nothing and doesn't output anything.
:For example: in a command block.
== List and summary of commands ==
The table below summarizes all commands.
 Summary of Commands
Command	Description 										
 	An alias of . Provides help for commands. 										
 	Grants or revokes a player ability. 										
 	Gives, removes, or checks player advancements. 										
 	An alias of . Locks and unlocks the day-night cycle. 										
 	Queries, adds, removes or sets an entity attribute. 										
 	Adds player to banlist. 										
 	Adds IP address to banlist. 										
 	Displays banlist. 										
 	Creates and modifies bossbars. 										
 	Switch to custom camera perspectives and fade the screen. 										
 	Used to enable a camera shaking effect. 										
 	Changes a setting on the dedicated server while it's running. 										
 	Clears items from player inventory. 										
 	Remove spawnpoints in the world. 										
 	Copies blocks from one place to another. 										
 	An alias of . Attempts to connect to the websocket server. 										
 	Applies damage to the specified entities. 										
 	Gets, merges, modifies and removes block entity and entity NBT data. 										
 	Controls loaded data packs. 										
 	An alias of . Locks and unlocks the day-night cycle. 										
 	Starts or stops a debugging session. 										
 	Attempts to connect to a websocket server. 										
 	Sets the default game mode. 										
 	Revokes operator status from a player. 										
 	Opens NPC dialogue for a player. 										
 	Sets the difficulty level. 										
 	Adds or removes status effects. 										
 	Adds an enchantment to a player's selected item. 										
 	Used to trigger an event on an entity. 										
 	Executes another command. 										
 	An alias of . Adds or removes player experience. 										
 	Fills a region with a specific block. 										
 	Fills a region with a specific biome. 										
 	Used for managing active fog settings for players. 										
 	Forces chunks to constantly be loaded or not. 										
 	Runs a function. 										
 	Sets a player's game mode. 										
 	Sets or queries a game rule value. 										
 	To test the GameTest features. 										
 	Gives an item to a player. 										
 	An alias of . Provides help for commands. 										
 	Allows setting immutable state of a world. 										
 	Manipulates items in inventories. 										
 	Starts or stops a JFR profiling. 										
 	Kicks a player off a server. 										
 	Kills entities (players, mobs, items, etc.). 										
 	Lists players on the server. 										
 	Locates closest structure, biome, or point of interest. 										
 	Drops items from an inventory slot onto the ground. 										
 	Displays a message about the sender. 										
 	Enables/disables a specified mob event. 										
 	An alias of and . Displays a private message to other players. 										
 	Allows the player to control playing music tracks. 										
 	Grants operator status to a player. 										
 	An alias of . Reloads and applies permissions. 										
 	Removes entries from the banlist. 										
 	Removes entries from the banlist. 										
 	Creates particles. 										
 	Captures info and metrics about the game for 10 seconds. 										
 	An alias of . Reloads and applies permissions. 										
 	Used to place a configured feature, jigsaw, template, or structure at a given location. 										
 	Used to run a one-off animation. 										
 	Plays a sound. 										
 	Opens single-player world to local network. 										
 	Draw a random value or control the random number sequence. 										
 	Gives or takes player recipes. 										
 	Reloads loot tables, advancements, and functions from disk. 										
 	Removing agent. 										
 	Replaces items in inventories. 										
 	Control execution flow inside functions and change their return value. 										
 	Used to make entities ride other entities, stop entities from riding, make rides evict their riders, or summon rides or riders.										
 	Prepares a backup, queries its status, or resumes. 										
 	Saves the server to disk. 										
 	Disables automatic server saves. 										
 	Enables automatic server saves. 										
 	Displays a message to multiple players. 										
 	Delays the execution of a function. 										
 	Manages scoreboard objectives and players. 										
 	. 										
 	. 										
 	Displays the world seed. 										
 	Changes a block to another block. 										
 	Sets the time before idle players are kicked. 										
 	Sets the maximum number of players allowed to join. 										
 	Sets the world spawn. 										
 	Sets the spawn point for a player. 										
 	Make one player in spectator mode spectate an entity. 										
 	Teleports entities to random locations. 										
 	Stops a server. 										
 	Stops a sound. 										
 	Used to save and load structures without having to use structure blocks items in inventories. 										
 	Summons an entity. 										
 	Controls entity tags. 										
 	Controls teams. 										
 	An alias of . Specifies the message to send to team. 										
 	An alias of . Teleports entities. 										
 	An alias of and . Displays a private message to other players. 										
 	Displays a JSON message to players. 										
 	Counts entities matching specified conditions. 										
 	Tests whether a block is in a location. 										
 	Tests whether the blocks in two regions match. 										
 	Add, remove, or list ticking areas. 										
 	Changes or queries the world's game time. 										
 	Manages screen titles. 										
 	Controls screen titles with JSON messages. 										
 	An alias of . Specifies the message to send to team. 										
 	Toggles the weather. 										
 	An alias of . Teleports entities. 										
 	Sets a trigger to be activated. 										
 	Transfers a player to another server. 										
 	Add, remove, or list volume areas. 										
 	An alias of and . Displays a private message to other players. 										
 	An alias of . Ability to edit restricted blocks. 										
 	Sets the weather. 										
 	Manages server whitelist. 										
 	Manages the world border. 										
 	An alias of . Ability to edit restricted blocks. 										
 	An alias of . Attempts to connect to the websocket server. 										
 	An alias of . Adds or removes player experience. 										
===Hidden commands===
These commands are unavailable in general cases. Most of them can be accessed with a Websocket Server.
Summary of Hidden Commands
Command	Description 								
 	Controls the agent. 								
 	Sets Code Builder state for a player. 								
 	Ability to edit restricted blocks. 								
 	Closes the chat window of the local player if it is open. 								
 	Closes websocket connection if there is one. 								
 	Launches Code Builder. 								
 	Enable encryption for the current websocket connection. 								
 	Gets pixels for a specific chunk. 								
 	Gets list of chunks that are loaded. 								
 	Shows the information about the client. 								
 	Shows the information about the server. 								
 	Shows the name of the local player. 								
 	Gets the spawn position of the specified player(s). 								
 	Gets the position of the top non-air block below the specified position. 								
 	Sets or gets the paused state of the game for all players. 								
 	Handle Educational Lesson reporting. 								
 	Lists the information about players on the server. 								
 	Gets transform, name, and id information about the given target entity or entities.								
 	Spawns an item entity at position. 								
 	Takes a photo of a player or from a player's point of view. 								
===Removed commands===
Summary of Removed Commands
Command	Description 	Version Removed	Reason for Deletion 				 	 	 	 	 	 	
 	Gives or takes an achievement from a player 	(17w13a) 	Achievements were superseded by advancements 				 	 	 	 	 	 	
 	Bans a player by IP number 	 	Superseded by 				?	 	 	 	 	 	
 	Modifies the data tag of a block 	(17w47a) 	Superseded by 				 	 	 	 	 	 	
 	Broadcasts a message across the entire server 	 	Superseded by 				 	 	 	 	 	 	
 	Force chunks to load constantly or not 	 	Superseded by 				 	 	 	 	 	 	
 	Clears fixed inventory slots 	(build 2) 	? 				 	? 	? 	 	 	 	
 	Execute a command when condition is met. 	 	Superseded by 				 	 	 	 	 	 	
 	Modifies the data tag of an entity 	(17w45b) 	Superseded by 				 	 	 	 	 	 	
 	Execute a command. 	? 	? 				 	 	 	 	 	 	
 	Teleports player to the world spawn 	 	Superseded by 				 	 	 	 	 	 	
 	Mixer interactivity control. 	 	Mixer was discontinued 				 	 	 	 	 	 	
 	Locates biomes. 	 	Superseded by 				?	? 	? 	?	?	?	?
 	Used to place a configured feature at a given location. 	 	Superseded by 				 	 	 	 	 	 	
 	Toggles player coordinates to be displayed on the HUD. 	 	Superseded by 				 	 	 	 	 	 	
 	Replaces items in inventories. 	(20w46a) 	Superseded by 				 	 	 	 	 	 	
 	Update the villagers' supply for economic trade. 	? 	? 				 	 	 	 	 	 	
 	Sets fixed inventory slot with a specific item. 	(build 2) 	? 				 	? 	? 	 	 	 	
 	Sets the amount of fixed inventory slots 	(build 2) 	? 				 	ava Edi	on Inde	 	 	 	
 	Sets the current location as the default spawn location for new players	 	Superseded by 				 	 	 	 	 	 	
 	Toggles between placing stone and placing bedrock 	 	Bedrock was added to the creative inventory as a separate item				 	 	 	 	 	 	
 	Update objectives from command results 	(17w45a) 	Merged with 				 	 	 	 	 	 	
 	Toggles the weather 	(17w45a) 	Redundancy with 				 	 	 	 	 	 	
 	Transfer player to a server. 	 	? 				 	 	 	 	 	 	
 	Pardons a banned player 	 	Superseded by 				 	 	 	 	 	 	
 	Attempts to connect to the websocket server to send a video stream. 	? 	? 				 	 	 	 	 	 	
 	Attempts to run a action on video stream. 	? 	? 				 	 	 	 	 	 	
 	Sets the spawn state of the warden. 	(22w11a) 	Temporary Command. 				 	 	 	 	 	 	
====Other removed commands====
=====Developer command=====
Developer commands are only enabled in internal development builds of Bedrock Edition, and are not normally present in release versions.
=====Agent commands=====
Superseded by 
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* 
===Joke commands ===
These commands only exist in April Fools versions of the game.
*
*
*
*
==History==
===Command additions and changes===
===April Fools command===
==Issues==
==See also==
*Argument types
*Coordinates
*Entity format
*Formatting codes
*Raw JSON text format
*Target selectors
==References==
 
Category:Server
de:Befehl
es:Comandos
fr:Commandes
hu:Szerverparancsok
it:Comandi
ja:コマンド
ko:명령어
nl:Opdrachten
pl:Polecenia
pt:Comandos
ru:Команды консоли
th:คำสั่ง
tr:Komutlar
uk:Команди консолі
zh:命令