Skip to content

Instantly share code, notes, and snippets.

Last active Dec 22, 2021
What would you like to do?
A simple clusterssh clone to ssh into many machines at once in a single tmux session. Use `set synchronize-panes` to send commands to all panes at once.
# tssh -- Andrew Fresh <andrew AT>
set -e
if [ -z "$*" ]; then
echo "usage: tssh server1 [[[server2] server3] ...]"
exit 2
next="new-session -d"
for s in "$@"; do
new="$new $next ssh $s ; select-layout tiled ;"
export TMUX_TMPDIR=`mktemp -td tssh-XXXXXXXXX`
[ -z "$TMUX_TMPDIR" ] && exit 1
trap 'rm -rf "$TMUX_TMPDIR"' 0 1 2 15
tmux $new set-option exit-unattached on \; attach-session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment