This is an old revision of tmux from 08/22/2017 09:38 edited by EvaggelosBalaskas.

View source for terminal multiplexer

== tmux ==

tmux ~~> **T**erminal **MU**ltiple**X**er


== architecture ==

%%

session 
    windows
        panes

%%


=== 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
%%

===  equally balance panes ===


==== Vertically ====
%%

:select-layout even-vertical

prefix + alt + 2 
%%

==== Horizontally ====

%%
:select-layout even-horizontal

prefix + alt + 1
%%


=== zoom into a pane ===

%%
prefix + z
%%


=== send-keys ===

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
%%

=== 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

%%