Skip to content

Instantly share code, notes, and snippets.

@L3viathan
Last active November 22, 2023 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save L3viathan/b1c9c2c3bc20dfa3b5cab61e261a52dc to your computer and use it in GitHub Desktop.
Save L3viathan/b1c9c2c3bc20dfa3b5cab61e261a52dc to your computer and use it in GitHub Desktop.
Start a tmux pane for each of the specified hosts, in synchronized-panes mode
#!/bin/bash
if (( $# > 6 )); then
layout=tiled
else
layout=even-vertical
fi
hosts=( "$@" )
tmux new-window
tmux send-keys "ssh ${hosts[0]}"
for i in $(seq 1 $((${#hosts[@]} - 1)))
do
tmux split-window
tmux send-keys "ssh ${hosts[$i]}"
tmux select-layout $layout
done
tmux setw synchronize-panes
tmux send-keys Enter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment