Kill command
Kill Command in Minecraft Java Edition.
Kill the player who used the command
/kill
Kill a player by name
/kill <player>
Entity Modifier
Using the "@e" modifier allows you to select the entity type to kill
Kill all slimes in the world.
/kill @e[type=minecraft:slime]
Kill all entities that are not a player
Using "!" before the entity type will result in all entities that are not that entity type to be killed
/kill @e[type=!player]
Range Modifiers
Adding the "r" modifier to the command allows you to set a range on the command, This will be from the player who used the commands position.
Kill all cows within 20 blocks of the player.
/kill @e[type=minecraft:cow,r=20]