Updated:

1. Summon a warden

/summon warden ~ ~ ~
/summon warden ~ ~ ~10

The same command works in Java and Bedrock. Moving or making noise nearby makes it chase you, so in survival spawn it a few blocks away. If nothing disturbs it for a while, it digs back into the ground.

2. Frozen statue (Java)

/summon warden ~ ~ ~ {NoAI:1b,Invulnerable:1b,PersistenceRequired:1b,Silent:1b}

This warden never moves, cannot be hurt and stays silent. See the NoAI command for more.

3. Add atmosphere

/effect give @a minecraft:darkness 30
/playsound minecraft:entity.warden.emerge hostile @a ~ ~ ~

4. Remove wardens

/kill @e[type=warden]

/kill also removes invulnerable wardens.

5. Stop natural spawning (Java)

/gamerule minecraft:spawn_wardens false

In Java 1.21.10 and earlier the rule is named differently:

/gamerule doWardenSpawning false

6. Avoid being found

Troubleshooting

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.