Linux/tmux

From Wiki

Shortcuts

CTRL-b + d         detach

Windows(=Tabs)
CTRL-b + c         create window
CTRL-b + w         list windows
CTRL-b + n         next window
CTRL-b + p         previous window
CTRL-b + &         kill window

Panes(=Splits)
CTRL-b + %         vertical split
CTRL-b + "         horizontal split

CTRL-b + o         switch panes
CTRL-b + q         show pane numbers
CTRL-b + x         kill pane

Reattach

tmux a

tmux ls

tmux attach -t 0
tmux attach -t test

Other

tmux kill-session -t test

.tmux.conf

set -g mouse on
set -g prefix2 C-a    # also allow CTRL-a as trigger combination

Scripting

  • mux.sh
#!/bin/sh

tmux new-session -d -s cluster
tmux send-keys -t cluster "ssh vm-docker0" ENTER "sudo bash" ENTER "watch docker ps" ENTER

tmux split-window -v -p 66
tmux send-keys -t cluster "ssh vm-docker1" ENTER "sudo bash" ENTER "watch docker ps" ENTER

tmux split-window -v -p 50
tmux send-keys -t cluster "ssh vm-docker2" ENTER "sudo bash" ENTER "watch docker ps" ENTER

tmux attach-session -d


Links