LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

clusterssh

simultaneous SSH to multiple hosts

TLDR

Open SSH connections to multiple hosts
$ cssh [host1] [host2] [host3]
copy
Connect to hosts defined in a cluster tag
$ cssh [cluster_name]
copy
Connect with specific username
$ cssh -l [username] [host1] [host2]
copy
Connect to hosts from a file
$ cssh -f [hosts.txt]
copy
Open connections with custom terminal
$ cssh -T [/usr/bin/xterm] [host1] [host2]
copy
List configured clusters
$ cssh -L
copy

SYNOPSIS

cssh [options] [hosts|clusters]

DESCRIPTION

ClusterSSH (cssh) opens multiple SSH terminal windows simultaneously, with a control window that broadcasts keystrokes to all connections. This enables running the same commands across multiple servers in parallel.Each host gets its own xterm window, arranged on screen automatically. Typing in the control window sends input to all terminals simultaneously. Individual terminals can be selected for host-specific commands.Clusters can be predefined in configuration files, grouping hosts by function (web servers, databases, etc.). Clusters can include other clusters, building hierarchies for complex environments.

PARAMETERS

-l username

Username for SSH connections.
-f file
Read hosts from file (one per line).
-T terminal
Terminal application to use.
-L
List configured clusters.
-c config
Use alternate configuration file.
-o options
Pass options to SSH.
-t title
Set window title.
-a command
Run a command in each session immediately after connecting.
-p port
Override the default SSH port.
-Q
Do not close cssh when the last terminal exits.
-q
Quiet mode, suppress warnings.
-d
Enable debug output (can be repeated up to level 4).

CONFIGURATION

Clusters defined in ~/.clusterssh/clusters:

$ webservers web1 web2 web3
dbservers db1 db2
all webservers dbservers
copy

INSTALL

sudo dnf install clusterssh
copy
sudo zypper install clusterssh
copy

CAVEATS

Requires X11 display; cannot run in headless environments. Screen real estate limits practical simultaneous connections (typically 10-20 hosts). All hosts receive identical input; be careful with destructive commands. Network latency differences may cause commands to execute at slightly different times.

HISTORY

ClusterSSH was written by Duncan Ferguson and first released in the early 2000s. It addressed the common need to manage multiple similar servers before configuration management tools like Ansible became widespread. The tool remains popular for ad-hoc tasks and interactive troubleshooting where simultaneous access to multiple hosts is beneficial.

SEE ALSO

tmux(1), pssh(1), ansible(1), ssh(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid