Minecraft servers allow players to connect and play Minecraft multiplayer together. Server operators have access to various console commands that allow them to modify, configure, and administer the Minecraft server.
Here are 11 of the most popular and useful Minecraft server console commands and what they do:
say
The say
command allows the server to broadcast a message to all players connected to the server.
Usage:
say <message>
This will display to all online players.
For example:
say Hello everyone, welcome to the server!
gamemode
The gamemode
command changes the game mode of a player. Game modes determine if a player can take damage, destroy blocks, fly etc.
Usage:
gamemode <mode> [player]
The game modes are:
survival
(0)creative
(1)adventure
(2)spectator
(3)
For example:
gamemode creative Steve
This will change Steve’s gamemode to creative.
weather
The weather
command changes the weather in the Minecraft world.
Usage:
weather <clear|rain|thunder> [duration in seconds]
For example:
weather thunder 6000
This will make it thunder for 6000 seconds (100 minutes).
time
The time
command changes or queries the world time.
Usage:
time set <value>
time add <value>
time query
The <value>
can be:
- daytime – 1000 to 12000
- nighttime – 13000 to 22000
For example:
time set 6000
This will set the time to sunrise.
give
The give
command gives an item to a player.
Usage:
give <player> <item> [amount] [data] [components]
For example:
give Steve diamond_sword 1 0 {display:{Name:"Sword of Truth"}}
This will give Steve 1 diamond sword with a custom name.
tp
The tp
command teleports entities, like players.
Usage:
tp [target player] <destination player/coordinates>
For example:
tp Matilda Steve
This will teleport Matilda to Steve’s location.
tp @a 0 64 0
This will teleport all players to x=0, y=64, z=0 coordinates.
kick
The kick
command kicks a player from the server.
Usage:
kick <player> [reason]
For example:
kick Steve Sorry, no griefing allowed!
ban
The ban
command bans players from joining the server.
Usage:
ban <name> [reason]
For example:
ban MinecraftHacker Because they were hacking.
pardon
The pardon
command unbans a banned player.
Usage:
pardon <player>
For example:
pardon MinecraftHacker
save-all
The save-all
command saves the server state. It writes player data, worlds etc. to disk.
Usage:
save-all
It’s a good idea to regularly save the server state with this command.
stop
The stop
command gracefully stops the Minecraft server.
Usage:
stop
This will save game state and disconnect players before shutting down the server.
Those are some of the most used Minecraft server console commands and what they do. Server admins should get familiar with these to efficiently operate their Minecraft server.
How to Use Minecraft Server Commands
Accessing the Server Console
The first step is accessing the server console. This allows you to enter commands directly on the server. Here’s how:
- For Java Edition servers, open the Command Prompt or Terminal window where you started the server. This is typically where the server JAR file is located.
- For Bedrock Edition, you’ll need to enable cheat mode. To do this, click “Pencil Icon” in the world settings and toggle “Cheats” to “On”. Then press “Enter” to open the text box to type commands.
Once you have console access, you can start entering commands.
Running Basic Commands
The most basic usage of a Minecraft command is:
/command argument1 argument2
For example, to change your gamemode to creative:
/gamemode creative
Some common basic commands include:
/time set day
– Sets time of day/weather clear
– Changes weather to clear/give @p diamond_sword
– Gives you a diamond sword/tp PLAYER X Y Z
– Teleports player to coordinates
Target Selectors
Many commands support target selectors to specify which player(s) to apply the command to:
@p
– Nearest player@r
– Random player@a
– All players@e
– All entities
For example:
/gamemode creative @a
This changes every player on the server to creative mode.
You can also narrow down selectors by using:
name=NAME
– Players with NAMEx=X,y=Y,z=Z
– Players at these coordinatesr=RADIUS
– Players within radius
Managing Players
Here are some useful commands for managing players:
/kick PLAYER [reason]
– Kick player from server/ban PLAYER [reason]
– Ban player from server/pardon PLAYER
– Unban player/tp PLAYER1 PLAYER2
– Teleport PLAYER1 to PLAYER2/give PLAYER ITEM [amount] [data]
– Give player an item
For example:
/ban Notch You shouldn't be here!
Controlling Time
You can control the time of day using:
/time set DAYTIME
– Set time of day/time add TIME
– Add TIME to current time
DAYTIME can be values like:
- 1000 = sunrise
- 6000 = midday
- 12000 = sunset
- 18000 = midnight
For example:
/time set 18000
Sets the time to midnight.
Changing Game Rules
To modify the rules of the game, use /gamerule
:
/gamerule rule value
For example:
/gamerule doDaylightCycle false
This stops the day-night cycle.
Some useful game rules include:
- doFireTick – Whether fire spreads
- doMobSpawning – Whether mobs spawn
- doWeatherCycle – Whether weather changes
See Gamepedia for a full list of gamerules.
Running Commands in Repeat
You can have commands run repeatedly using command blocks or functions:
- Command blocks – Place and power a command block containing a command
- Functions – Create a
*.mcfunction
file with commands
For example, creating a clearInventory.mcfunction
file with:
clear @a
give @a cooked_beef 64
Will repeatedly clear inventories and give steak when run.
Automating Commands with Datapacks
For large collections of custom commands and automation, you can use datapacks. Datapacks allow you to write functions, loot tables, structures, and more.
Some things you can do with datapacks:
- Custom crafting recipes
- Custom villager trading
- Custom advancements
- Custom loot tables
- Custom structures
Datapacks take more work to set up but allow for deep customization.
Executing Commands with Server Scripts
For Java Edition servers, you can automate running commands using shell/batch scripts.
For example, a restart.sh
script could contain:
say Server restarting!
save-all
stop
java -Xmx2G -jar server.jar nogui
This script would:
- Announce restart
- Save world
- Stop server
- Restart server
Scripts allow integrating OS functionality with Minecraft servers.
How do I enable commands on my Minecraft server?
Here are the steps to enable commands on a Minecraft server:
For Java Edition Servers
- Make sure you have operator/admin permissions on the server.
- Start the server and agree to the EULA by changing
eula=false
toeula=true
in theeula.txt
file. - Stop the server.
- Open the
server.properties
file in a text editor. - Find the
enable-commands
setting and set it totrue
:
enable-commands=true
- Save the changes and restart the server.
Commands should now be enabled. Test it out by running a command like /gamemode creative
on the server.
For Bedrock Edition Servers
- Start the world and click the pencil icon to access world settings.
- Click on “Game” in the settings sidebar.
- Enable the setting “Cheats: Off” to “Cheats: On”
- Click “Save” and commands will now be enabled.
- Test by running a command like
/gamemode creative
Enable cheats/commands only on trusted servers to avoid abuse. But used properly they open up many options for customizing gameplay.
How do I add admin commands to my Minecraft server?
Here are some ways to add admin commands to a Minecraft server:
Using Command Blocks
You can create command blocks that only admins/ops can edit.
- Go into creative mode (
/gamemode creative
) - Get a command block (
/give @s command_block
) - Configure the command block with an admin command like
/gamemode creative @p
- Set the command block to require OP permission.
Now only admins can run that command.
Install Admin Mods/Plugins
Many mods and plugins like Essentials or WorldEdit add extra admin commands. Install them on your server to enable more administrative abilities.
Some useful ones:
- Essentials – Adds commands like
/spawn
,/warp
,/kick
etc. - WorldEdit – Advanced world editing and terraforming commands.
- LuckPerms – Permission management for granular admin powers.
Read mod documentation to learn the new commands.
Use Datapacks
With datapacks you can create custom crafting, loot tables, functions, and more. Useful for admin utilities.
For example a datapack function could have:
give @p netherite_sword
effect @p strength 30
Load the datapack on the server to access those admin functions.
Set Up Command Permissions
Use a permissions plugin like LuckPerms to set specific command permissions for admin ranks.
Give only certain players access to commands like /ban
, /teleport
, etc.
This allows granular admin powers.
With a bit of setup, you can create all kinds of custom admin commands on your Minecraft server for moderation, world editing, and more!
How do you fix command blocks are not enabled on this server?
Here are a few things you can try to fix the “command blocks are not enabled on this server” error:
- Make sure cheats/commands are enabled in the server settings. For Java Edition servers, set “enable-command-block=true” in the server.properties file. For Bedrock Edition, enable “Cheats” in the world settings.
- Check that you have operator/admin permissions on the server. Command blocks require at least basic operator status to use.
- Use the “/gamerule commandBlockOutput false” command. This allows command blocks to run commands even if they cannot output results.
- Check if any server plugins/mods are blocking command blocks. Some anti-griefing plugins prevent untrusted players from using cmds.
- Make sure the command in the command block is valid. Syntax errors or unrecognized commands can cause issues.
- Try placing and using the command block in a brand new “superflat” creative world. If it works there, something in the server world is interfering.
- As a last resort, completely delete the “world” folder and regenerate the world. This resets all data which can clear any corrupted data.
If you still can’t get command blocks working, contact the server host/admin to troubleshoot permissions or configs that may be blocking command blocks.
With the right settings, they should function on any vanilla Minecraft server.
Conclusion
Mastering Minecraft commands helps unlock the full potential of servers.
Start with simple player and time commands, then explore powerful options like command blocks, functions, datapacks and scripts.
Let me know if you have any other great uses for Minecraft commands!