Command blocks are mechanical blocks that when powered by redstone will run a command of your choice. To access the command blocks you must be an operator on the server/realm and in creative mode. It cannot be found in your creative inventory. You will need to spawn it in from by typing /give <your username> command_block. Due to its ability to affect all aspects of the game, command blocks are not accessible in survival mode.
Activation of Command Blocks
Now that you have command blocks the next step is to activate it. Any powered redstone current will activate an attached command block. Keep in mind, that command blocks that are not currently within render distance will not activate.
Different Types of Command Blocks
There are three types of command blocks.
Impulse: Runs commands with a redstone signal. That means once powered they will run the command once and then stop.
Repeat: Runs the commands every game tick they are powered by default. Multiple commands can be run in a single tick. You can also set the delay between each tick or list of commands being executed.
Chain: Can only be executed once the previous blocks have gone through their set of commands.
There are many things that you can do with command blocks since the command blocks use a pseudo scripting language within Minecraft. In more structured uses you can also create automated systems.