Safety first: The Minecraft command /kill @e[type=!player] does not kill only mobs. It targets all non-player entities in loaded areas, including dropped items, pets and decorative objects. To remove a specific mob, use a type filter such as /kill @e[type=zombie]. Use a limited radius where possible and test a copy of your world before destructive commands.
The right command for removing a specific mob
If you only want to remove zombies, enter /kill @e[type=zombie]. This selector targets the zombie entity type rather than every object and animal in the world. The same basic syntax works in Java and Bedrock Edition when you have permission to run commands. It affects matching entities in loaded areas; it cannot reach all mobs saved in unloaded chunks. A command targeting a type also affects named members of that type, so do not use it near a pet or custom mob of the same type without checking.
Java and Bedrock radius examples
To remove only zombies near the command's execution position, use /kill @e[type=zombie,distance=..20] in Java Edition. In Bedrock Edition, use /kill @e[type=zombie,r=20]. Both examples have a 20-block radius but use different selector arguments. The execution position matters: a command typed by a player, run from a command block, or executed from a server command context may use a different origin. Make a backup or test in a separate world before running any bulk cleanup.
Why /kill @e[type=!player] is dangerous
The selector @e refers to entities. The condition type=!player excludes players, but it does not mean only hostile or living mobs. Dropped items, armor stands, item frames, paintings, minecarts, named pets and passive animals can all be included. /kill @e[type=!player] can therefore destroy valuable objects or creations. It is not a safe lag-fix command for a live server. A distance filter only limits the area; it does not protect other kinds of entities. Never promote this selector as a way to kill mobs while preserving everything else.
Can one command target every hostile mob?
There is no single, reliable cross-edition vanilla selector meaning every hostile mob but no other entity. A predictable cleanup is to use one named entity type at a time, for example /kill @e[type=creeper] or /kill @e[type=zombie], and restrict the radius where needed. Java does not accept multiple positive type filters, such as type=zombie,type=skeleton, in a single selector. Bedrock offers families such as family=monster, but category membership should be checked for the actual version and add-ons; it is not a universal guarantee that every desired mob is included and all other entities are excluded.
Misleading commands explained
/kill @e[type=mob] is not a general all-mobs command in vanilla Java. /kill @e[type=!player,tag=Protected] targets entities that have the Protected tag; it does not spare them. Using tag=!Protected instead can exclude tagged entities, but untagged items and pets remain at risk if the broader selection is still used. Similarly, excluding armor stands or cows with type=! does not transform a broad selector into “hostiles only.” Filter each example by what is actually being targeted, and never assume an exclusion list is complete.
Permissions, loaded chunks, and server performance
In single player, commands typically need cheats enabled; on a multiplayer server, operator or equivalent permissions are needed. The kill command can have permanent consequences in survival or creative worlds. On production servers, identify the source of lag before touching entities: excessive mobs, item piles, chunk loading, plugin behavior, redstone and farms require different fixes. Removing many entities is not a substitute for diagnosing server tick performance. A command may also fail or behave differently when your edition, version, plugins or add-ons introduce custom entities.
Alternatives to mass killing
If your aim is to prevent future natural spawns, consider the world rule /gamerule doMobSpawning false, while remembering that it does not disable every possible method of spawning entities. Changing the difficulty to Peaceful also alters the whole world's gameplay and is not a no-impact administrative cleanup. For ordinary survival, spawn-proofing, managing farm overflow, and fixing item-collection systems are often more appropriate. In a shared world, communicate any planned changes and keep a recent backup. A deliberate and limited action is better than a global kill selector.
Sources and further reading
The official Microsoft Bedrock selector reference documents the r radius and entity filters; the Minecraft Wiki command reference compares the Java and Bedrock syntax. The previous article also linked to Minecraft mods and Minecraft PS5 news; those old links remain available but are not evidence for command syntax.



