Although Minecraft is a survival sandbox game that gives players a lot of freedom, players can unlock even more freedom by using Minecraft commands. These commands allow players to control gameplay, automate actions, and manage servers more effectively. Wondering what they are? Let’s break them down.
Table of Contents
How to Run a Command
- Create New World and press More World Options…
- Set Allow Cheats to ON
- If you forget, enable it during the game via Settings > Open to LAN > Allow Cheats ON > Start LAN World.
- Enter your game and press / in the chat box. If the command prompt appears, you’re ready to start typing Minecraft commands.
To enable command blocks on a server, make sure enable-command-block=true is set in your server.properties file.
Things to Know Before Using Commands
- Minecraft commands aren’t simple cheats; they often auto-suggest further arguments as you type.
- Expect a short learning curve.
Using Arguments
Commands often require “arguments” to be effective. For example:
- /gamemode creative xxx → sets the player “xxx” to Creative mode.
- Typing /gamemode or /time alone will prompt further syntax suggestions.
Using Targets
You can direct commands to specific targets using these selectors:
- @p = nearest player
- @r = random player
- @a = all players
- @e = all entities
- @s = self (command issuer)
Example:
- /kill @a → instantly kills all players on the server.
Quick Selector Reference
Selector | Description |
@p | Nearest player |
@r | Random player |
@a | All players |
@e | All entities |
@s | Self (command issuer) |
Commonly Used Minecraft Commands
Command | Description |
/help | Lists all commands or gives usage tips. |
/gamemode creative [playername] | Changes a player’s mode to Creative. |
/tp @a <player name> | Teleports all players to the specified player. |
/weather <type> [duration] | Changes weather to Clear, Rain, or Thunder. |
/time set day/night | Sets time to day or night. |
/time add <value> | Skips forward in time. |
/give <player> <item> <amount> | Gives items to players. |
/locate <structure> | Locates the nearest structure. |
/enchant <player> <enchantID> <level> | Enchants the item a player is holding. |
/xp add <player> <amount> <points/levels> | Adds XP or levels to a player. |
/experience | Alias for /xp to manage experience. |
/gamerule <rule> <value> | Modifies game behavior like daylight cycle or mob spawning. |
Most Useful For:
- Creative building: /give, /gamemode, /setblock
- Exploration: /tp, /locate, /time set, /weather
- XP/Enchantments: /xp, /enchant, /effect
Advanced Commands for Server Admins
These commands offer powerful administrative control:
Command | Description |
/ban <player> <reason> | Bans a player. |
/ban-ip <IP> | Bans by IP address. |
/banlist | Shows all banned users. |
/clear <target> <item> <amount> | Removes items from inventory. |
/clone <x1> <y1> <z1> … | Clones and places block structures. |
/data | Interact with NBT data. |
/datapack | Manages datapacks. |
/debug <start/stop/report> | Controls debug sessions. |
/defaultgamemode <mode> | Sets default game mode. |
/deop <player> | Revokes operator status. |
/difficulty <level> | Changes difficulty. |
/effect give/clear | Applies or clears effects. |
/execute | Executes chained commands. |
/kick <player> <reason> | Kicks a player. |
/kill <target> | Kills entities or players. |
/list [uuids] | Shows online players. |
/loot | Spawns items or loot tables. |
/msg or /tell | Sends private messages. |
/op <player> | Grants operator status. |
/pardon <player> | Unbans a player. |
/pardon-ip <IP> | Unbans an IP. |
/playsound | Plays a sound effect. |
/recipe | Grants or removes recipe access. |
/reload | Reloads advancements/functions. |
/replaceitem | Replaces items in inventory or blocks. |
/save-all | Saves the world. |
/save-off | Disables auto-save. |
/save-on | Enables auto-save. |
/say <message> | Broadcasts a message. |
/seed | Shows the world seed. |
/setblock | Changes one block to another. |
/setidletimeout | Sets AFK timeout. |
/setworldspawn | Sets the global spawn point. |
/spawnpoint | Sets a player’s spawn point. |
/spectate <player> | Enters spectate mode. |
/spreadplayers | Randomly spreads players. |
/stop | Stops the server. |
/stopsound | Stops sound effects. |
/summon <entity> | Summons a mob or entity. |
/tag | Manages tags for entities. |
/team | Manages teams. |
/teammsg | Sends team-only messages. |
/tellraw | Sends raw JSON messages. |
/title | Manages screen titles. |
/trigger | Activates trigger objectives. |
/whitelist add/remove | Manages whitelist. |
/whitelist on/off/list/reload | Whitelist control. |
/worldborder | Sets world boundaries. |
Admin Pro Tips:
- Avoid OP-ing strangers: Only trusted players should have access to powerful commands.
- Backup regularly: Use /save-all frequently or set up auto backups.
- Use /execute carefully: It allows complex logic and is very powerful but can break worlds if misused.
A Note on Command Blocks
Command blocks allow automation and advanced logic without using mods. To use them:
- Enable them in your server.properties (enable-command-block=true).
- Use /give @p command_block to get one.
- Right-click to insert commands just like chat, but for automatic execution.
Use these for things like teleport systems, custom maps, and redstone machines.