Skip to content

Instantly share code, notes, and snippets.

@ammardev
Last active November 17, 2021 15:01
Show Gist options
  • Save ammardev/2a6b3d19c06cd35ba4ef3274a0ac206f to your computer and use it in GitHub Desktop.
Save ammardev/2a6b3d19c06cd35ba4ef3274a0ac206f to your computer and use it in GitHub Desktop.
tmux cluster ssh
#!/bin/bash
tmux new-session -d -s mySession -n myWindow
tmux send-keys -t mySession:myWindow "ssh $1" Enter
shift
for var in "$@"
do
tmux split-window -h
tmux send-keys -t mySession:myWindow "ssh ${var}" Enter
done
tmux select-layout even-vertical
tmux select-layout even-horizontal
tmux setw synchronize-panes on
tmux attach -t mySession:myWindow
# Usage
#
# 1. Move the file to /usr/bin/cssh-tmux
# 2. cssh-tmux server1 server2 server3
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment