Mastering Minecraft Mob Elimination: A Guide to the /kill Command
There are many reasons to eliminate mobs in Minecraft.  The most efficient method is using commands, specifically the /kill command. While seemingly simple, this command offers nuanced control. This guide explains how to use it effectively.
Prerequisites: Enabling Cheats
Before using any commands, ensure your Minecraft world has cheats enabled. Instructions for both Java and Bedrock editions are provided below.
The /kill Command: Syntax and Usage
The basic /kill command, entered in the chat box, will unfortunately kill you.  To target mobs, you need to add specific syntax.
To kill all mobs (excluding the player):
/kill @e[type=!minecraft:player]  (@e selects all entities; type=!minecraft:player excludes the player.)
To kill specific mob types (e.g., chickens):
/kill @e[type=minecraft:chicken]
Targeting mobs within a specific radius:
- Java Edition: 
/kill @e[distance=..15](kills all entities within 15 blocks) - Bedrock Edition: 
/kill @e[r=10](kills all entities within 10 blocks) 
Combining type and distance for targeted elimination (e.g., sheep within 15 blocks):
- Java Edition: 
/kill @e[distance=..15,type=minecraft:sheep] - Bedrock Edition: 
/kill @e[r=10,type=minecraft:sheep] 
Minecraft will autocomplete commands, minimizing the need for memorization.
Important Entity Selectors:
Understanding these selectors is key:
@p: Nearest player@r: Random player@a: All players@e: All entities@s: Yourself
Enabling Cheats in Minecraft:
Java Edition:

- Enter your world.
 - Press Esc.
 - Select "Open to LAN."
 - Toggle "Allow Commands" to "On."
 - Commands will now function. Note: This must be repeated each time you open the world. To permanently enable cheats, create a world copy with cheats enabled using the "Re-create" option in the Singleplayer menu.
 
Bedrock Edition:

- Locate your worlds.
 - Select the world and click the pencil icon.
 - In the settings menu, find the "Cheats" option.
 - Toggle "Cheats" to "On."
 
Minecraft is available on PlayStation, Xbox, Nintendo Switch, PC, and mobile devices.
