Of course, you can also execute this command for adventure maps where you do not want mobs spawning all over the place. Make sure you know what you are doing and always test in a world you do not necessarily care about if you are executing a command like killing all entities. FAQs ...
To kill all slimes: /kill @e[type=slime] To kill all mobs but not kill any of the players (including yourself): /kill @e[type=!player] Example in Java Edition (PC/Mac) 1.11 and 1.12 To kill yourself in Minecraft 1.11 and 1.12: /kill To kill the player named Axe2Grind: /kill ...