Created
May 21, 2014 14:03
-
-
Save greggroth/658fb907ff8311705099 to your computer and use it in GitHub Desktop.
Control multiple ssh connections using Tmux. It creates a new tmux window with a pane ssh'd to each listed host and syncronizes the panes so input is sent to each pane. Inspired by csshx (https://code.google.com/p/csshx/).
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_ssh () { | |
tmux send-keys 'ssh ' $1 'C-m' | |
} | |
split_and_ssh () { | |
tmux split-window -h | |
tmux_ssh $host | |
} | |
tmux new-window | |
tmux_ssh $1 | |
for host in ${@:2}; do | |
split_and_ssh $host | |
done | |
tmux select-layout tiled | |
tmux setw synchronize-panes on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: