Minecraft wiki entry for Commands, associated text: Entered by a player in the chat window.
Executed by a command block or Minecart with command block.
In functions or scripts, as part of a data pack or add-on.
In a multiplayer server, entered in the console.
Click a Json text that has "run_command" action.‌[Java Edition only]
Executed with a WebSocket server.‌[Bedrock Edition only]
Executed by an NPC.‌[Bedrock Edition only]