Minehost
Home/Blog/Minecraft server commands: the essential list with examples

Minecraft server commands: the essential list with examples

11 min readMineHost Team

The first few minutes with a new server look the same for almost everyone. You join the game, you want to switch to creative or kick the friend who has just set the village on fire, and the game answers with a red message as if the command did not exist at all. Commands are the basic admin tool, and without them you are running the server half blind. We have gathered the ones a server owner actually uses, grouped by what they are for, with examples ready to paste.

Which version this guide covers

Every example applies to Minecraft Java Edition 26.x. Bedrock has a very similar set of commands, but the syntax differs in a few places, so lean on the in-game suggestions there.

Where commands go: in-game chat or the console

Commands can be issued from two places. The first is the in-game chat, opened with the T key or straight away with the slash key. The second is the server console in the panel, the window that shows everything the server writes to its logs in real time. The difference is small but can catch you out.

WhereLeading slashPermissionsWhen it is handy
In-game chatYes, e.g. /time set dayDepend on the operator level the player hasWhen you are in the world and want something done right away
Panel consoleNo, time set day is enoughFull, the same as the ownerFirst setup, granting permissions, working while nobody is online
The console always has full permissions, which is why setting up a new server starts there.

The Tab key does half the work

Start typing a command and press Tab. The game suggests the rest of the name, a player's nick or an item ID. With names like minecraft:netherite_chestplate that saves a lot of typos.

The first command on a new server: /op

A freshly installed server has no admin. Even the person who paid for it joins as an ordinary player and can use almost nothing. So the first step is to open the console in the panel and make yourself an operator.

Server console
op YourNick

From then on you can use commands from the in-game chat as well. Taking the permissions away works the same way, the command is just called deop. An operator has a level from 1 to 4 and gets the highest one by default. This is controlled by the op-permission-level option in server.properties.

LevelWhat it allows
1Building and breaking blocks in the protected area around spawn. It unlocks practically no commands.
2Gameplay commands: changing game mode, teleporting, giving items, time, weather, game rules, command blocks.
3Managing people: kicking, banning, granting and removing operator, the whitelist.
4Matters of the server itself, such as saving the world manually and shutting the server down.
Each level also includes everything the lower levels allow.

Operator is not a reward for a friend

A player with full operator rights can take yours away, wipe someone's inventory or stop the server in the middle of the evening. If someone is helping you keep order, give them only the commands they need through a permissions plugin such as LuckPerms.

Selectors: pointing a command at the right target

In most commands you can type a selector instead of a nick. It is a shortcut that finds players or other entities in the world by itself. It comes in handy when you want to do something to everyone at once or cannot remember exactly how the person next to you spells their name.

SelectorWhat it targets
@pThe nearest player
@aEvery player on the server
@rA random player
@sWhoever runs the command, usually you
@eAll entities: players, mobs, animals, items lying on the ground
@nThe nearest entity of any kind

A selector can be narrowed down by adding conditions in square brackets. A few combinations come up again and again in practice:

  • @e[type=item] means items lying loose on the ground.
  • @a[distance=..20] means players within 20 blocks of you.
  • @e[type=zombie,limit=3] means at most three zombies.
  • @a[gamemode=creative] means everyone currently in creative mode.

Careful with /kill @e

The bare @e selector also covers players, tamed dogs, horses and the villager whose trade someone waited a week for. When removing entities always add a type, e.g. /kill @e[type=item].

Managing players

These are the commands you reach for most once the server gets busy. A reason for a kick or ban is optional, but worth adding. The player sees it on the disconnect screen, and a month later you still remember why someone was removed.

CommandWhat it doesExample
/listShows who is online right now/list
/kickRemoves a player, who can rejoin straight away/kick Jack chat spam
/banBlocks a player account permanently/ban Jack wrecking other builds
/ban-ipBlocks the IP address the player connects from/ban-ip Jack
/pardonLifts an account ban/pardon Jack
/pardon-ipLifts an IP ban/pardon-ip 203.0.113.25
/banlistLists banned accounts or addresses/banlist players
/msgSends a private message, also works as /tell and /w/msg Emma come to spawn
/saySends an announcement everyone can see/say restart in 5 minutes

Be careful with IP bans. Siblings playing from the same home usually share an address, so banning one cuts off the other too. On the other hand, plenty of players get a new address from their provider after a router restart, so such a ban is often less effective than it looks.

The whitelist: a server for your own people

If you play in a closed group, the whitelist is the simplest way to keep strangers out, even if the server address leaks somewhere. Once it is on, only people added to the list by nick can join.

Whitelist commands
/whitelist on
/whitelist add Jack
/whitelist remove Jack
/whitelist list
/whitelist off
/whitelist reload

The last one is useful when you edit whitelist.json by hand over SFTP. The server will not notice changes to the file on its own, you have to make it load them. We explained why the whitelist matters for younger players in our guide to a Minecraft server for your child.

Game mode, teleporting and items

These are the commands players associate with the cheat codes of old. All of them need at least operator level 2. If you leave out the player, the command applies to you.

CommandWhat it doesExample
/gamemodeChanges game mode: survival, creative, adventure or spectator/gamemode creative Jack
/tpTeleports to a player or to given coordinates/tp 120 70 -340
/giveGives an item in the chosen amount/give Jack minecraft:oak_log 64
/clearClears the whole inventory or a single item/clear Jack minecraft:tnt
/effectApplies or removes an effect, e.g. night vision/effect give Jack minecraft:night_vision infinite
/enchantEnchants the held item, within the normal level limit/enchant Jack minecraft:efficiency 5
/xpAdds experience in points or levels/xp add Jack 30 levels
/spawnpointSets the player respawn point where you are standing, unless you give coordinates/spawnpoint Jack
/killKills the target/kill Jack

Teleporting has a few variants worth knowing. /tp Jack moves you to Jack, /tp Jack Emma moves Jack to Emma, and /tp @a @s pulls every player to you, which is handy before a group screenshot or the opening of a new build. You can check your own coordinates on the F3 screen.

Where /gm 1 and /fly come from

Shortcuts like /gm 1, /gmc, /fly or /heal are not part of the game. They are added by the EssentialsX plugin. On a plain server they return an unknown command message, and the game mode has to be typed in full.

The world: time, weather, difficulty and map borders

CommandWhat it doesExample
/time setSets the time of day: day, noon, night or midnight/time set day
/time addMoves time forward by a number of ticks, 1000 is one in-game hour/time add 6000
/weatherChanges the weather to clear, rain or thunder/weather clear
/difficultySets difficulty: peaceful, easy, normal, hard/difficulty hard
/setworldspawnMoves the world spawn to where you stand/setworldspawn
/worldborderSets the world border, you give its width in blocks/worldborder set 10000
/seedShows the seed the map was generated from/seed
/locatePoints to the nearest structure or biome/locate structure minecraft:village_plains

The world border is one of the more underrated commands. Every new piece of map someone explores takes up disk space and processor time to generate. On a server for a handful of people a border 10 thousand blocks wide is still a huge area, and it prevents one player from flying thousands of blocks ahead on an elytra and slowing the game down for everyone else. Set the centre of the border with /worldborder center 0 0.

Game rules with /gamerule

Game rules change how the whole world behaves with a single command. Typing just the rule name without a value shows its current setting.

Old guides will not work here

Since version 1.21.11 game rules have new names written in lowercase with underscores. The well known keepInventory is now keep_inventory, and doDaylightCycle is called advance_time. If a command copied from a video a few years old returns an error, this is the most common reason.
RuleWhat it changesExample
keep_inventoryPlayers keep their inventory and experience after death/gamerule keep_inventory true
advance_timeWhen off, the day and night cycle stops/gamerule advance_time false
advance_weatherWhen off, the weather stops changing/gamerule advance_weather false
mob_griefingWhen off, creepers do not destroy blocks and endermen do not pick them up/gamerule mob_griefing false
players_sleeping_percentageWhat percentage of players must sleep to skip the night. At 0 one person is enough/gamerule players_sleeping_percentage 0
spawn_phantomsWhen off, the phantoms that attack sleepless players stop spawning/gamerule spawn_phantoms false
immediate_respawnSkips the death screen so the player respawns at once/gamerule immediate_respawn true
pvpWhen off, players cannot damage each other/gamerule pvp false

There is one catch with mob_griefing. The same rule also lets villagers harvest crops and sheep eat grass. If you run an automatic farm where villagers plant and harvest crops, it stops working once the rule is off.

Building with commands

For bigger building jobs a few commands save hours of placing blocks by hand. Coordinates can be absolute or relative, written with a tilde. ~ ~-1 ~ means the block right under your feet, and ~5 ~ ~ five blocks further along the X axis.

CommandWhat it doesExample
/setblockPlaces a single block at a given spot/setblock ~ ~-1 ~ minecraft:glowstone
/fillFills the box between two corners/fill ~-5 ~-1 ~-5 ~5 ~-1 ~5 minecraft:stone_bricks
/cloneCopies a part of the world somewhere else/clone 0 64 0 10 70 10 100 64 100
/summonSummons a mob or another entity/summon minecraft:villager ~ ~ ~

You can add a mode at the end of /fill. hollow makes a shape that is empty inside, outline places only the walls without clearing the inside, and replace followed by a second block swaps only the chosen material, for example all grass for moss.

A large /fill can stall the server

By default one command can cover at most 32,768 blocks. The limit is set by the max_block_modifications rule, but even within it filling a large area on a busy server causes a noticeable freeze. For really big changes the WorldEdit plugin is more comfortable, and before any larger operation it is worth making a backup in the panel.

Commands for running the server itself

These are best typed in the console. Some of them have buttons in the panel, but it is good to know what happens underneath.

CommandWhat it is for
save-allWrites the world to disk immediately, without waiting for the automatic save.
save-offPauses automatic saving. Rarely needed, e.g. while copying world files by hand. Type save-on afterwards.
stopSaves the world and shuts the server down cleanly. Safer than killing the process.
tick queryShows how long a server tick takes on average. Useful when players report lag.
reloadOn a plain server it reloads data packs. On Paper it touches plugins too and can make a mess, so after changing a plugin a full restart is the better choice.

On Paper you also have /tps and /mspt for checking performance. If the numbers look bad and a quick /kill @e[type=item] does not help, the cause usually lies deeper. We covered that in more detail in our guide to optimising paper.yml and spigot.yml.

Plugin commands that the plain game does not have

Players coming from big servers expect commands that are really added by plugins. If your server runs on Paper, you can add them in a few minutes, as described in our guide on how to install plugins on a Minecraft server.

CommandComes fromWhat it is for
/sethome, /homeEssentialsXSaving a home and going back to it with one command
/tpa, /tpacceptEssentialsXA teleport request the other player has to accept
/spawn, /warpEssentialsX with the Spawn add-onQuick trips back to spawn and to saved points
/lpLuckPermsGroups and permissions, e.g. a moderator rank that can only kick
//wand, //setWorldEditSelecting and reshaping large parts of the map

When a command does not work

Most command problems come down to a handful of recurring situations. The in-game message usually makes it fairly clear which one it is.

What you seeWhat it usually means
Unknown or incomplete commandA typo, a missing part of the command, a command from a plugin the server does not have, or missing permissions. The game hides commands a player has no access to, so they look as if they did not exist.
You do not have permissionThis is how plugin commands usually respond. Your rank lacks the permission for the command, so it has to be granted in a permissions plugin such as LuckPerms.
No player was foundThe player is offline or the nick is misspelled. Letter case does not matter, every letter does.
A command from a video returns a syntax errorThe game has changed the syntax. This applies especially to game rules and to /give with the old curly bracket format, replaced by components in version 1.20.5.
Works in the console, not in gameAlmost always a permissions issue, since the console has more of them than anyone in game. Make yourself an operator from the panel console.
Messages are quoted from the English version of the game.

Quick FAQ

Can a command be undone?

No. The game has no undo button, so a mistyped /fill or /clear stays for good. The only way back is a backup, which is why it is worth making one in the panel with a single click before experimenting.

Where does the server store operators and bans?

In ops.json, banned-players.json, banned-ips.json and whitelist.json in the main server folder. You can look at them over SFTP, but changing them with commands is simpler and safer.

Can players without operator use any commands?

Yes, a few harmless ones such as /msg, /me, /list or /help. Anything that changes the world or gives an advantage in game needs permissions.

How do I enable command blocks?

In server.properties set enable-command-block=true and restart the server. You get the block itself with /give @s minecraft:command_block, and only an operator in creative mode can place and edit it.


Your own server, where every command is yours

A console in the browser panel, server files over SFTP, one click backups and protection against DDoS attacks. The server is ready a few minutes after you buy it.

See Minecraft packages