You will not find a command block in the creative inventory. There is no tab it shows up in, and it cannot be crafted in survival either. One command is the only way to get one:

/give @s minecraft:command_block

That puts it in your inventory. Getting it to actually do something adds three conditions, and most attempts fail on one of them.

The three prerequisites

Operator rights. Only an operator can place and edit a command block. In single-player that means cheats have to be enabled for the world.

Creative mode. Even as an operator you can only open the input field in creative mode. In survival the block stays silent, even when it is already placed and correctly set up.

The game rule. Whether command blocks work at all is controlled by command_blocks_work, default true:

/gamerule command_blocks_work true
Important
The old enable-command-block entry in server.properties no longer has any effect. It moved into this game rule with snapshot 25w35a. Finding it in an older guide and setting it to true changes nothing. The complete list is in Minecraft game rules.

What goes in the input field

Right-click opens the block. The command goes into the upper field — the leading slash is optional here; say Hello and /say Hello do the same thing.

The command runs at permission level 2. That covers the world commands: /setblock, /fill, /tp, /time, /give, /effect and similar all work. Admin commands such as /ban, /op or /stop sit above that level and are refused inside a command block. Which command sits at which level is covered in Minecraft commands.

Below the input field, "Previous Output" shows what the command reported last time it ran. That is the fastest way to debug: if it mentions an unknown entity or a selector that matched nothing, the problem is the command, not the block.

The three types

The colour tells you which type you are looking at.

ColourTypeBehaviour
Orangeimpulseruns the command once per trigger
Greenchainruns as soon as the block it faces has run
Purplerepeatruns the command every tick while active

You switch the type with the button in the input window; the block changes colour accordingly.

The impulse block is the default case: one redstone signal, one run. The repeat block works twenty times a second, because a tick is a twentieth of a second. The chain block is the interesting one, because it turns single commands into sequences.

Building chains

A chain block faces in one direction and waits for the block in front of it to run. Line several up and they execute in exactly that order — within the same tick, one immediately after the other.

That lets you break a sequence apart instead of forcing everything into one command:

impulse  →  tp @a 100 65 100
chain    →  effect give @a minecraft:resistance 10 1
chain    →  title @a title {"text":"Welcome"}

Only the orientation matters: every chain block has to face its predecessor. A block orients itself by the direction you are looking when you place it, which is the most common reason a chain runs only halfway.

Conditional, unconditional and the redstone question

Two more switches sit in the input window.

Conditional or unconditional. A conditional block only runs its command if the block behind it succeeded. That is how you build abort conditions: if step two fails, step three stays put. Unconditional is the default and always runs.

Needs redstone or always active. By default a block waits for a redstone signal — a lever, a pressure plate, a comparator. Set to always active, it needs none. For repeat blocks that is the usual setting; for impulse blocks it rarely makes sense.

A comparator next to a command block reads its success count. If the last run matched a target, the comparator emits a signal — useful for reacting to the result of a command.

Keeping the chat quiet

By default every command block reports each execution to all operators. With a repeat block that means twenty messages a second. Two game rules switch it off:

/gamerule command_block_output false
/gamerule send_command_feedback false

command_block_output covers the blocks' messages, send_command_feedback command feedback in general. Both default to true.

Three examples that work

A welcome message on entering an area. Repeat block, always active:

execute as @a[x=100,y=64,z=100,distance=..5] run title @s actionbar {"text":"Enter at your own risk"}

A teleport pad. Impulse block under a pressure plate:

tp @p 250 70 -130

Daylight while anyone is nearby. Repeat block, always active:

execute if entity @a[x=0,y=0,z=0,distance=..200] run time set day

For all three: try them in single-player or on a test server first. A repeat block with a faulty command produces an error twenty times a second.

Keeping an eye on performance

A single repeat block goes unnoticed. Several dozen of them scanning every entity in the world through @e on every tick is a real load — and one that shows up in no plugin statistic.

Two habits help: keep selectors as narrow as possible, @a[distance=..10] rather than @a, and switch repeat blocks off once they are no longer needed. If your server stutters and you use command blocks, they belong on the suspect list — more on that in optimizing Minecraft server performance.

Troubleshooting

ProblemCause and fix
The block will not openOperator rights or creative mode are missing.
The block does nothing at allThe game rule command_blocks_work is false.
The impulse block does not reactNo redstone signal, or it is set to "needs redstone" with no trigger.
Only the first block of a chain runsA chain block is not facing its predecessor.
/ban or /op are refusedThese sit above permission level 2 and are not allowed in a command block.
The chat is flooded with messagesSet command_block_output and send_command_feedback to false.
"Previous Output" reports an errorThe command itself is wrong, not the block. Check the syntax.
The server has stuttered since you built itRepeat blocks with wide selectors run twenty times a second.

Frequently asked questions about command blocks

How do I get a command block?

Only through /give @s minecraft:command_block. It is not in the creative inventory and cannot be crafted.

Why can I not open the command block?

Placing and editing require operator rights and creative mode. In survival the input field stays closed, even if the block is already placed.

What is the difference between impulse, chain and repeat?

The orange impulse block runs its command once per trigger. The green chain block runs right after the block it faces. The purple repeat block runs its command every tick, so twenty times a second.

Do I need the slash before the command?

No. Inside a command block it is optional, unlike in chat. In the server console it is always left out.

Which commands do not work in a command block?

Anything above permission level 2, meaning admin commands such as /ban, /kick, /op, /deop and /stop. World commands like /setblock, /fill, /tp or /time work fine.

How do I turn off the chat messages?

With /gamerule command_block_output false for the blocks' own messages and /gamerule send_command_feedback false for command feedback in general.

Does enable-command-block in server.properties still work?

No. The entry moved into the command_blocks_work game rule with snapshot 25w35a. In server.properties it does nothing any more.