Commands

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**, 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 `T` / File:Chat button.png‌[*BE & EE only*] / ‌[*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 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 or scripts, as part of a data pack or add-on.
* In a multiplayer server, entered in the console.
* Click a Json text that has "run\_command" action.‌[*Java Edition only*]
* Executed with a WebSocket server.‌[*Bedrock Edition only*]
* Executed by an NPC.‌[*Bedrock Edition only*]

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.

**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.

## Command guide

### Syntax

In *Java Edition*:

 `ellipsis ...` | Another **sub-command** is required.

In Bedrock Edition:

 `[entry]` | This entry is **optional**.

### 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 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

Some commands have 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 regardless of whether cheats are 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. This is true if the permission level is higher than 2 in In *Java Edition* and higher than 1 in In Bedrock Edition

## List and summary of commands

The table below summarizes all commands, including upcoming ones.

### Hidden commands

  File:Information icon.svg

**This feature is exclusive to Bedrock Edition.**

These commands are unavailable in the general case. Most of them can be accessed with Websocket Sever.

### Removed commands

#### Other removed commands

##### Developer command

Main article: developer commands

  File:Information icon.svg

**This feature is exclusive to Bedrock Edition and  *Education Edition*.**

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

##### Agent commands

Template:Education feature
Superseded by `/agent`

* `/move`
* `/turn`
* `/attack`
* `/destroy`
* `/drop`
* `/dropall`
* `/inspect`
* `/inspectdata`
* `/detect`
* `/detectredstone`
* `/transfer`
* `/createagent`
* `/tpagent`
* `/collect`
* `/till`
* `/place`
* `/getitemcount`
* `/getitemspace`
* `/getitemdetail`

## See also

* Argument types
* Coordinates
* Entity format
* Formatting codes
* Raw JSON text format
* Target selectors

## References

Template:Commands
Template:Java Edition
Template:Bedrock Edition

de:Befehl
es:Comandos
fr:Commandes
hu:Szerverparancsok
it:Comandi
ja:コマンド
ko:명령어
nl:Opdrachten
pl:Polecenia
pt:Comandos
ru:Команды консоли
th:คำสั่ง
tr:Komutlar
uk:Команди консолі
zh:命令