Commands

From Minecraft Wiki

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

List of Commands[edit | edit source]

Syntax[edit | edit source]

If one sees... Then...
plain text Enter this exactly as shown
<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 separated by vertical bars.
ellipsis (...) The argument may consist of multiple words separated by spaces.

Singleplayer Commands[edit | edit source]

Command Syntax (Usage) Action Operator Only? Success conditions
/help /help <command> Shows the syntax of a command. No If no command is specifed, the syntax for every command usable by the player will be shown.
/attribute get|modifier) Edits the Attributes of the targeted entity. Yes

Targeted <entity> must exist, targeted player must be online.

/me /me <text> Shows a player's username then <text> (i.e. /me ran outputs *Player ran). Depends on the server If <text> parameter is entered in.
/whisper (/msg /tell) /whisper <player> <message> Tells a private message to <player>. No If <player> and <message> parameters are entered and <player> must be online.

/achievement

(Older than snapshot 1.12 called 17w13a)

/achievement give <stat_name> [player] Gives an achievement or +1 value to a statistic to [player]. If an achievement is given, all its prerequisites will be given as well. Yes If no player is specified, defaults to the command's executor. Must be specified if in a command block. <stat_name> must be a valid Statistic or achievement name.




/ability

(Only available on Minecraft: Education Edition)

/ability <player><grant/revoke> <ability> Gives or Revokes an ability to a player, such as fly or world builder. Yes All fields filled out. If no player is specified, defaults to the command's executor. Fails if ability is already given/revoked. Exp. The command "/ability Steve grant fly" would fail if Steve already had the fly ability.
/advancement

/advancement <grant|revoke|test> <player> <advancement> [criterion]

Gives or takes an advancement from a player, or tests if a player has an advancement. Yes If no player is specified, defaults to the command's executor. Must be specified if in a command block. The advancement must be valid.
/clear /clear <player> [item ID] [DV] [maximum amount taken] [DataTag] Clears [Item ID] from <player> if [DV] and [DataTag] match the one in the inventory. If [item ID] is not specified, it completely erases a player's inventory. Yes All tags, DV, stack count, and item id must match <player> must be online.
/clone /clone <x> <y> <z> <dx> <dy> <dz> <x2> <y2> <z2> [type] Copies the area within the first two sets of coordinates and pastes it at the third. Yes The maximum cube volume is 32,768 blocks (2^15)(8 chunks). The "copy" and "paste" locations cannot overlap.
/debug /debug <start - stop> Starts profiling a debug session or stops one. Yes
/defaultgamemode /defaultgamemode <survival - creative - adventure - spectator> Sets the server's default game mode for when players join for the first time. Yes The game mode must be specified.
/data

If getting data from block entity:

/data <get - merge - remove> <block> <pos> [<path>] [<scale>]

If getting data from mobile entity (mob):

/data <get - merge - remove> <block> <target> [<path>] [<scale>]

Allows the player to view, modify or delete NBT data. Yes
/difficulty /difficulty <peaceful - easy - medium - hard> Changes the difficulty of the server. Yes Difficulty must be specified.
/effect /effect <player> <effect_name> [Time(seconds)] [amplifier] [(show particles) true - false] Gives <player> <effect ID> [amplifier] for [Time] seconds. Yes <player> must be online. <Effect ID> must be a valid ID. [Amplifier] cannot go below 0 and cannot exceed 255. [Time] cannot exceed 1000000.
/enchant /enchant <player> <enchantment_name> [Enchantment level] Enchants the item in <player>s hand with <enchantment_name>. Yes <player> must be online. <ID> must be an applicable enchantment name (e.g. Sharpness on a sword, but not on a bow). If [Enchantment level] is specified, it cannot go over the maximum level for the enchant. Changes if the enchantment is already on the item.
/execute /execute <as - at - if - in - positioned - facing - store - result> Executes <command> at the location of <player or entity>, relative to <z> <y> <z>. Yes If a player is specified, he/she must be online.
/fill /fill <x> <y> <z> <dx> <dy> <dz> <block Name>[destroy - hollow - keep - outline - replace <Block Name>] Fills the between the 2 coordinates with <block Name>. If replace is used for oldBlockHandling, the next parameter tells what block <block Name> should be replaced. Yes Maximum cube volume is 32,768 blocks (2^15)(8 chunks). Block name must be a valid name.
/gamemode /gamemode <survival (0) - creative (1) - adventure (2) - spectator (3)> [player] Changes [player]'s gamemode to <survival - creative - adventure - spectator>. Yes Game mode must be specified. If a player is unspecified, defaults to the command's executor. Must be specified if in a command block.
/gamerule /gamerule <gamerule> [true|false|numerical value] It sets a game rule to be true or false. If the value is not specified, the game rule's value is returned. If the game rule does not exist, it creates a new game rule that does not impact gameplay except via commands. See below for existing game rules. Yes <Gamerule> must exist if the value is not specified.
/give /give <targets> <item> [<count>] [<damage>] [<nbt>]Minecraft 1.14 Syntax:

/give <targets> <item>[<nbt>] [<count>]

Gives <targets> a number of <item>s equal to <count>. Specified <damage> and <nbt> data are applied to the item/block. In 1.14, damage must be applied with the Damage tag. Yes All <targets> must be valid players on the server. <item> must be a valid id. If specified, [<count>] must be at least 1 and no greater than 2,147,483,647. [<nbt>] must be of legal syntax.
/kill /kill <player> Deals 3.4*10^38 (2^128) void damage to <player>. Yes <player> must be online, if specified. If no player is specified, defaults to the command's executor. Must be specified if in a command block.
/locate /locate <structure> Enters the coordinates of the closest <structure> in the chat. Yes Valid structures are: End City, Nether Fortress, Woodland Mansion, Abandoned Mineshaft, Ocean Monument, Stronghold, Desert Temple, Igloo, Jungle Temple, Swamp Hut, Ocean Ruin, Shipwreck, Buried Treasure, Village, and Pillager Outpost. 
/particle /particle <name> <x> <y> <z> <dx> <dy> <dz> <speed> [count] [player] Displays the particle <name> at <x> <y> <z>, viewable only by [player] (if specified) [count] times at the specified <speed> and <dx> <dy> <dz>. Yes If a player is specified, he/she must be online. Particle names must be valid.
/playsound /playsound <sound> <player> [<x> <y> <z>] [volume] [pitch] [minimumVolume] Plays <sound> to <player>. Yes <player> must be online. <player> must be able to hear the sound from the coordinates (if specified). volume must be at least 0.0. Pitch must be between 0.0 and 2.0. The minimum volume must be between 0.0 and 1.0.
/publish /publish Opens the world to LAN. Yes
/recipe /recipe <give|take> [player] <name> Unlocks or locks the recipe <name> for [player] (only has an effect if the gamerule doLimitedCrafting is true). Yes If no player is specified, defaults to the command's executor. Must be specified if in a command block.
/reload /reload Reloads all functions, loot tables, etc. Yes Always works
/say /say <message> Broadcasts <message>. Appears as "[<player>] <message>" Yes
/scoreboard /scoreboard <objectives|players|teams> Changes scoreboard settings/options with the used parameters. See Scoreboard. Yes
/seed /seed Tells the world seed. Yes As of 1.13, you can click on the seed ID to copy the seed to clipboard.
/setblock /setblock <x> <y> <z> <Block name> [dataValue] [oldBlockHandling] [dataTag] Sets <block name> at the coordinates listed. Yes The block name must be a valid Block name.
/setworldspawn /setworldspawn [x] [y] [z] Sets the server spawnpoint to [x] [y] [z]. If no coordinates are specified, it will be at the executor's position. Yes Range is -30000000 to 30000000 for x and z, and 0 to 255 for y.
/spawnpoint /spawnpoint <player> [x] [y] [z] Sets <player>'s spawnpoint at [x] [y] [z]. If no coordinates are specified, it will be at the executor's position. Yes Range is -30000000 to 30000000 for x and z, and 0 to 255 for y.
/spreadplayers /spreadplayers <x> <z> [spreadDistance] [maxRange] [respectTeams] <playernames> Spreads players out with a distance of [spreadDistance] between them within a radius of [maxRange]. Yes
/summon /summon <entity> <[x] [y] [z]> [NBT Tag] Spawns a <Savegame ID> at [x] [y] [z]. If [dataTag] is specified, the data will go into the mob. Certain mobs cannot be spawned. Yes <Savegame ID> must be an actual entity, and the coordinates must be between -30000000 and 30000000 for the x and z, and at least 0 for the y. If the coordinates are unspecified the entity, it is summoned at the executor's location.
/tellraw /tellraw <player> <raw json message> Sends a message to a player. When combined with /trigger, allows for non-ops to successfully click text. Yes <player> must be online. <raw json message> must be correctly coded in JSON.
/testfor /testfor <player> <raw json coordinates> Tests for a player at specific coordinates. yes <player> must be at exact coordinates.
/time /time set <value> /time add <value>

/time query <day - gametime - game>

Sets the time to <value> or adds <value> ticks to the current time. Sets time to <day - noon - night - midnight> Adds t (ticks), d (days), s (seconds) [1.14 Upcoming]. Yes
/tp /tp <player> <player2> OR /tp <player> [<x> <y> <z>] [<rx> <ry>] Teleports <player> to <player2> or <x> <y> <z>. Yes <player> and <player2> must be online. <x> <y> <z> parameters must be in the range of -3000000 and 3000000.
/trigger /trigger <objective> <add|set> <value> Adds or sets <value> to the <objective> for a player. It proves useful in tellraw texts as it is non-op friendly. Partial (see scoreboard)
/weather /weather < clear|rain|thunder> [Time (seconds)] Changes the weather to < clear - rain - thunder> for [Time] seconds. Yes [Time] must be 1000000 or lower, and the weather type has to be specified. If the time is unspecified, it will end at a natural pace.
/worldborder /worldborder set <size> [delay] -OR- /worldborder center <x> <z> Sets an impassible border that is <size> blocks as its area, and is centered on a location when "/worldborder center" is used. Any mobs out of the box will slowly take damage. Yes
/xp /xp <player> <amount> OR /xp <player> <amount>L Gives <amount> experience to <player>, or <amount>L levels to <player>. Yes <player> must be online. For individual experience, must be between 0 and 2,147,483,647 (2^31); for levels, must be between -2,147,483,648 and 2,147,483,647.

Multiplayer Commands[edit | edit source]

Command Syntax (Usage) Action Operator Only? Success conditions
The following commands are only available in multiplayer.
/tag /tag <player> <add - remove> <tag name> Adds a tag that can be used to determine what player to use using @a[tag=<tag name>]. Yes <player> must be online.
/ban /ban <player> [reason] Bans a player. Yes
/ban-ip /ban-ip <<address> - <player>> Stops a player's IP from coming on. Yes
/banlist /banlist [ips] Lets a player see the banned players. "IPS" makes players see banned ips. Yes
/deop /deop <player> Takes away operator powers from a player. Yes
/kick /kick <player> [reason] Disconnects a player from the server. Yes <player> must be online.
/list /list Lets players see all online players. No
/op /op <player> Gives a player operator powers. Yes
/pardon /pardon <player> Pardons, or unbans a player. Yes
/pardon-ip /pardon-ip <ip address> Pardons, or unbans an IP address. Yes
/save-all /save-all Makes the server save changes to the world save. Yes
/save-off /save-off Stops the server from making changes to the save. Yes
/save-on /save-on Makes the server make changes to the save. Yes
/setidletimeout /setidletimeout <minutes> Automatically kicks players after idling for <minutes> minutes. Yes
/stop /stop Saves all changes to the save, then shuts down the server. Yes

/whitelist

/whitelist <add - remove> <player> OR /whitelist list OR /whitelist <on - off> OR /whitelist reload. Whitelist options. Yes

Gamerules[edit | edit source]

Here are the list of game rules, which specifies what should be allowed, and what should not be allowed.

Syntax and Usage[edit | edit source]

  • Java Edition

gamerule <rule name> [value]

Arguments in Java Edition are case sensitive, as of 1.13.
  • Bedrock Edition
gamerule <rule: BoolGameRule> [true|false]

: OR

gamerule maxcommandchainlength [value: int]
Gamerule What it does
commandBlockOutput Enables/disables text output of command block commands to console. Defaults to true.
disableRaids Disables Illager raids (upcoming in JE 1.14.3). Defaults to false.
doFireTick Enables/disables fire spread. Defaults to true.
doMobLoot Enables/disables mob drops. Defaults to true.
doMobSpawning Enables/disables the spawning of mobs unless one wants them to ex: eggs and mob spawners will still spawn mobs. Defaults to true.
doTileDrops Enables/disables blocks dropping items when broken (includes TNT destroying blocks).
keepInventory Enables/disables keeping inventory on death. Defaults to false.
mobGriefing Enables/disables mobs from changing or destroying blocks. Defaults to true.
naturalRegeneration Enables/disables regenerating health when hunger is full or close to full. Defaults to true.
spectatorsGenerateChunks Whether players in Spectator Mode can generate chunks.
showDeathMessages Whether a message appears in the chat when a player dies.
logAdminCommands Whether to log admin commands to server logs.
spawnRadius The possible number of blocks outward from the world spawn coordinates that a player will spawn in when first joining a server or when dying without a spawnpoint.
doDaylightCycle Whether the day-night cycle and moon phases should progress.
doWeatherCycle Whether the weather should cycle or not. Defaults to true.
sendCommandFeedback Whether the feedback from commands executed by a player should show up in chat. Defaults to true.
reducedDebugInfo Whether the Debug Screen shows all or reduced information Defaults to false.
randomTickSpeed

How often a random block tick occurs (e.g. plant growth, leaf decay, etc.) per chunk section per game tick. Defaults to 3 (Java Edition) or 1 (Bedrock Edition)

maxEntityCramming Maximum number of mobs accepted within a 1:1 space before suffocating.
announceAdvancements Controls whether advancements should be announced in chat.
Bedrock Edition Only
commandBlocksEnabled Controls whether Command Blocks are enabled.
doInsomia Controls whether phantoms spawn at night or not.
drowningdamage Controls whether the player takes damage when drowning.
falldamage Controls whether the player takes fall damage.
fire damage Controls whether the player takes fire damage.
pvp Controls whether players should fight other players.
showcoordinates Whether the coordinates should be displayed. Always shown on left side of screen.
tntexplodes Controls whether TNT explodes.

Selectors[edit | edit source]

Selectors or Target Selectors are letters followed by an at sign (@) that can be used to apply the command to a player or entity without having to actually specify a player.

 @p: Nearest player, or yourself if in singleplayer.
@a: All players.
@r: Random player.
@e: All entities.
@s: Command's executor or current entity (1.12), does not work with command blocks.

Arguments[edit | edit source]

Brackets can be placed after a selector to specify conditions. If it's for any command that allows the use of selectors, these are called arguments.

The layout for this is: <selector>[<argument>=<value>,<argument>=<value>, ...]

Some include:

Argument Function / Action
x The X coordinate for the searched area. Also is one corner for cubic selection if dx is used.
y The Y coordinate for the searched area. Also is one corner for cubic selection if dy is used.
z The Z coordinate for the searched area. Also is one corner for cubic selection if dz is used.
dx

The x distance away from the command block.

(range goes to y and z)

dy

The y distance above from the command block.

(range goes to x and z)

dz

The z distance away from the command block.

(range goes to x and y)

distance Distance from player. Use [distance=..5] for entities within 5 blocks. Use [distance=5..] for entities further than five blocks.
NBT Named Binary Tag of the entity.
gamemode The gamemode of a player. This is an argument that can have an ! in front of the value, meaning "not".
level The maximum experience level amount.
limit The minimum experience level amount.
team The team this player is on. This is an argument that can have an ! in front of the value, meaning "not".
score The score for an objective.
sort
type The SaveGame ID for an entity. This is an argument that can have an ! in front of the value, meaning "not".
name The name of the entity. This is an argument that can have an ! in front of the value, meaning "not".
tag The tag owned by each entity. Entities with tags can be summoned using NBTs. See scoreboard command for more.

See also[edit | edit source]

External links[edit | edit source]