oh its bedrock only, but you can send the world file to a server and change the allow command block to false then join the game and break the command block (i was thought you can also do that using gamerule in singleplayer)
The world file can be opened in nbt mode and certain parameters can be changed, such as the game mode, the player's life, or whether command blocks can be used, etc.
/kill @e[distance=1..] would target every entity more than 1 block away from the point of execution, so basically everything except the player who executed the command. /kill @e[distance=..1] would work like a fancy /kill @s though.
One time my friend used /kill on everything in a 100 block radius in our realm and ruined it. We banned him and he was like βiT wAs JuST a MiSTaKeβ, anyways this reminded me of one of many bad things he did.
My server has a /kill incident, for when I accidentally typed/kill @a and we had to spend hours replacing lost villagers and pets ... that was a fun birthday
Funny that the items are counted as entities too. If you typed the command again, dropped objects like wheat and seed after you farm but never bothered to pick will disappear without traces.
realising the command block was purple
2 months of progress gone