Managing 5 Servers at Once with tmux
📆 2026-03-02 13:30
I manage five machines every day: tiny, lenovo1, lenovo2, lenovo3 and my nas. More info about my cluster can be found at the link below.
Opening five terminals and SSHing manually works - but it's repetitive,easy to mess up and something I don't want to do every time.
So I automated the entire thing with a small shell script that builds a complete tmux workspace for me.
The Idea
One command. Five panes. Five active SSH sessions. Synchronized input enabled. Instant cluster control.
Screenshot & Video
Managing 5 servers at once with tmux [ screenshot ]
Managing 5 servers at once with tmux [ video ]
The Script
Below is the exact script I use, with comments explaining each step.
What Happens When I Run It
The moment I execute the script:
- a tmux session is created (or reused if already running);
- the window splits into five evenly sized vertical panes;
- each pane automatically SSHs into its assigned machine;
- synchronized input is enabled;
- I am attached to the session;
- no manual setup;
- no tab juggling;
- no repeated SSH commands.
Why Synchronized Panes Matter
With synchronization enabled, I can:
- run updates on all machines at once;
- restart services everywhere;
- check disk usage across the cluster;
- run maintenance commands in parallel.
It turns five separate servers into something that feels like a single distributed shell.
Enabling/disabling synchronized panes
With this bind I can easily CTRL + b -> Shift + b to enable or disable synchronized panes in tmux.
Of course, this is powerful - and dangerous.
If I type:
It runs everywhere. Deliberate typing only and makes me think twice before pressing ENTER and mess something up.
Why Five Panes?
Five is the sweet spot for my screen. Everything fits. All machines are visible. Nothing is hidden.
Nah, I'm joking !!! My cluster is composed of 5 nodes but the script is easy to modify if I add or delete a node!
The Result
What used to be five terminals and constant context switching is now:
- one command;
- one window;
- five live systems;
- total and instant control.
If you manage multiple servers daily, scripting your tmux layout like this is worth the few minutes it takes to build.
It turns infrastructure management into something that feels almost orchestral.