tmux ~> Terminal MUltipleXer



attach / detach

tmux new -s session_name
    creates a new tmux session named session_name
tmux attach -t session_name
    attaches to an existing tmux session named session_name
tmux switch -t session_name
    switches to an existing session named session_name
tmux list-sessions
    lists existing tmux sessions
tmux detach (prefix + d)
    detach the currently attached session

ReadOnly attach session

$ tmux attach -t session_ebal -r

synchronize panes

ctl + b

:setw synchronize-panes on

:setw synchronize-panes off

Capture Pane

ctrl+prefix a : capture-pane -S [lines]

will save the tmux pane into a buffer

and after that

ctrl+prefix  a : save-buffer /tmp/output

to save the buffer into a text file named output under /tmp directory

equally balance panes


:select-layout even-vertical

prefix + alt + 2


:select-layout even-horizontal

prefix + alt + 1

zoom into a pane

prefix + z


eg. session:ebal

~> tmux list-windows -t ebal |cut -d: -f1|xargs -I{} tmux send-keys -t ebal:{} clear C-m

reload config

prefix + :

:source-file ~/.tmux.conf


$ vim ~/.tmux.conf

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# Shift arrow to switch windows
bind -n S-Left  previous-window
bind -n S-Right next-window
bind -n S-Up new-window

# Control + Arrow keys to pane switching
bind -n C-Up select-pane -U 
bind -n C-Down select-pane -D 
bind -n C-Left select-pane -L 
bind -n C-Right select-pane -R 

# Vertical Split - Control + v
bind -n C-v split-window
# Horizontal Split- Control + h
bind -n C-h split-window -h