Skip to content

Instantly share code, notes, and snippets.

@rafer
Created February 26, 2015 22:35
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 rafer/6b334a0fa0318e95283d to your computer and use it in GitHub Desktop.
Save rafer/6b334a0fa0318e95283d to your computer and use it in GitHub Desktop.
#!/bin/bash -e
if [[ $# -ne 1 ]]; then
echo "Simultaneous SSH session in tmux panes, courtesy of knife search"
echo "Usage: knifemux [knife search expression]"
exit 1
fi
tmux start-server
tmux new-session -d -s knifemux
for host in `knife search -i "$1" | tail +3`
do
tmux splitw -t knifemux "ssh $host"
tmux select-layout -t knifemux tiled
done
tmux kill-pane -t 0
tmux set-window-option -t knifemux synchronize-panes on
tmux at -t knifemux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment