# How do I run the same command on several servers at once, safely?

Open servers as panes of one tab, write a command once and read the card. Each host shows its own risk, and you type an answer before production runs it.

Source: https://valakes.com/guides/run-one-command-on-several-servers/

Last updated: 2026-11-27

Open the servers as panes of one tab, start a broadcast in Commands mode and write the command once. Valakes rates it for every host and runs it only on the hosts you confirm.

A broadcast puts the hosts, their environments and the risk of the command on one card before anything runs. Each pane is its own connection. To mark a host as production first, see [Mark a host as production so rm -rf asks first](https://valakes.com/guides/stop-rm-rf-on-production/). A host that is not connected or not at a prompt is greyed out on the card with the reason, and the other hosts can still run the command. The same card is part of [keeping a few servers in one place](https://valakes.com/use-cases/a-few-servers/) and of [working on production servers without fear of one wrong command](https://valakes.com/use-cases/production-servers/).

## Steps

1. **Open the servers as panes of one tab**

   A tab holds up to 6 panes, and each pane is its own connection to a host. Press `Ctrl+Shift+D` to split to the right or `Ctrl+Shift+O` to split downward (`Cmd+D` and `Cmd+Shift+D` on macOS). The host switcher opens, and the host you pick becomes the new pane.

   The picture shows one tab with three panes: a production host, a staging host and a development host. One composer serves the whole tab, and it belongs to the focused pane.

2. **Start a broadcast**

   Press **Broadcast** at the right end of the tab strip. A list of the tab's panes opens with a check box for each, and every pane that can join is already checked. Choose **Commands (checked per host)**, then press **Start broadcast**. No key starts a broadcast, so a stray key cannot do it.

   A pane cannot join if it is a local shell, if an agent opened it, if you shared it with an agent or the built-in assistant, or if it is not connected. The list shows it greyed out with the reason.

3. **Write the command and read the card**

   Write the command in the composer of one pane and press Enter. The composer lists the hosts after "To:". A card titled "Broadcast command" appears every time, even when every host is a development host and the command is harmless.

   The card has one row per host with its environment, its risk and the command as that host will run it. Each host judges its own risk, and a command rated Medium on a production host is raised to High. Uncheck a host to leave it out. A host that cannot run the command is greyed out with the reason, and nothing is sent to it.

   With one production host in the list, type its name to turn **Run** on. With two or more, type their number, for example "Type 2 to run on 2 production hosts". A High-risk command also needs the box "Run the High-risk command anyway". When the card holds a production host or a High-risk row, Cancel has the focus, so Enter does not run the command. The card expires after about two minutes.

4. **Keep passwords out of the command**

   Do not put a password in a broadcast command. Valakes never puts a saved password on the command line of a broadcast command. A host that needs one shows its Fill chip in its own pane, and you confirm it there, one host at a time.

   After a broadcast command starts, a program that waits for input on a host gets keys only from the focused pane. To type into all of them, use Keystrokes.

5. **Use keystrokes only for interactive programs**

   The other mode, **Keystrokes (raw, no checks)**, sends every key you type in the focused pane to all panes in the broadcast, as in Raw mode. Use it for `vim`, `top` or an interactive prompt. Nothing is checked, so a mistyped `rm` runs on every host.

   With a production host in the group, Valakes first asks "Send keystrokes to production hosts?" and the default is Cancel. While the broadcast runs, every pane shows a red banner such as "Keys go to 3 hosts, 1 production. Broadcast stops after 2 minutes without typing."

6. **Stop the broadcast**

   Press **Stop** in the status bar, press the "Broadcasting" button on the tab strip, or press `Ctrl+Shift+X` (`Cmd+Shift+X` on macOS). Switching to another tab stops it too.

   A keystroke broadcast also stops by itself after 2 minutes without typing, with a countdown in the last 15 seconds. A command broadcast has no timer. If Valakes cannot stop it, it says "The broadcast could not be stopped. Try Stop again." and the Stop button stays.

## What it does not do

A broadcast needs 2 to 6 panes of one tab, and only one broadcast runs in a window. Panes are not restored when you quit Valakes. Six panes with the default scrollback, all full, use close to 1.4 GiB of memory.

Keystroke broadcast runs no command check, and what you type is not read or explained. While keys are broadcast, Valakes writes no saved password to any pane. What you type at a password prompt goes to every host as keystrokes.

Broadcast commands are kept in the audit log with saved credentials removed. Valakes cannot recognize every secret and does not delete entries, so a password you type into a command yourself can stay in the log for good. A keystroke broadcast records only the number of bytes sent to each host.

Agents cannot start, join or send to a broadcast. There is no tool or API call for it.

## Documentation and help

[Read the docs: Panes and broadcast](https://docs.valakes.com/panes-and-broadcast/)

[Help centre: A broadcast stopped](https://support.valakes.com/a-broadcast-stopped/)

## Read next

- [Several servers in one tab](https://valakes.com/features/panes-and-broadcast/): A tab in Valakes can hold several terminals side by side, each its own connection to a host. Broadcast sends what you type to several of them at once, and production is held back until you answer.
- [How do I run one command on many servers over SSH?](https://valakes.com/learn/run-command-on-many-servers/): Put the host names in a file and run ssh -n -o BatchMode=yes -o ConnectTimeout=5 host command for each one, in a loop for a few servers or with xargs -P for many. Keep each host's output and exit status, so one host that fails never hides behind the others.
- [How do I keep a command running after I close SSH?](https://valakes.com/learn/keep-commands-running/): Start it inside tmux (tmux new -s name, then Ctrl-b and d to leave). If tmux is not there, put nohup in front of the command and an ampersand after it. When a terminal closes, the programs started in it get a hangup signal and stop, and both tools get around that.

The screenshots show Valakes built from commit 0b8738d, taken on 25 November 2026.
