Last active
November 17, 2021 15:01
-
-
Save ammardev/2a6b3d19c06cd35ba4ef3274a0ac206f to your computer and use it in GitHub Desktop.
tmux cluster ssh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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