Tmux Notes

start/exit tmux

$ tmux # start tmux servers 
$ tmux at # attach tmux sessions 
$ tmux ls # list tmux sessions 
$ exit # close tmux session

Session sharing

$ tmux new -s session_name # make new named session
$ tmux at -t session_name  # attach to exist session (allowing shared sessions)
$ tmux kill-session -t session_name  # kill named session

tmux commands

NOTE: All commands need to be prefixed with the action key.
      By default, this is CTRL-b

 c  - create new window
n/p - move to next/previous window
0-9 - move to window number 0-9
 f  - find window by name
 w  - menu with all windows
 &  - kill current window
 ,  - rename window

 %  - split window, adding a vertical pane to the right
 "  - split window, adding an horizontal pane below
←/→ - move focus to left/right pane
↑/↓ - move focus to upper/lower pane

 !  - Break current pane into new window
 x  - Kill the current pane.
 d  - detach the current client

 [  - enter copy mode (then use emacs select/yank keys)
      * press CTRL-SPACE or CTRL-@ to start selecting text
      * move cursor to end of desired text
      * press ALT-w to copy selected text

 ]  - paste copied text

 ?  - show tmux key bindings

Tmux Config

# Shortcut to load configuration:
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."

# Fast open and rename of window:
bind-key -n S-Down new-window -c "#{pane_current_path}"
bind-key -n S-Up command-prompt -I "rename-window "

# faster navigation between windows:
bind-key -n S-Left previous-window
bind-key -n S-Right next-window

# set history to 10000 entrys:
set-option -g history-limit 10000

# start number of windows with 1:
set-option -g base-index 1
set-window-option -g pane-base-index 1

# Pfeiltasten sofort nach Fenster-Wechsel freigeben:
set-option -g repeat-time 0

# make colours available:
set-option -g default-terminal screen-256color

# change status (check if /proc/loadavg  exist):
set -g status-interval 2
set-option -g status-justify left
set-window-option -g window-status-current-format '#I:#W#F'
set-window-option -g window-status-format '#I:#W#F'
set -g status-right-length 150
set -g status-right "| #(whoami)@#H | #(awk '{print $1,$2,$3}' /proc/loadavg) | %Y-%m-%d %H:%M "
# Aussehen der Infoleiste ändern:
set-option -g status on
set-option -g status-bg blue
set-option -g status-fg white
set-window-option -g window-status-current-bg magenta

# set promt:
set -g message-fg white
set -g message-bg black
set -g message-attr bright

# define panels of window:
set -g pane-border-fg green
set -g pane-border-bg black
set -g pane-active-border-fg green
set -g pane-active-border-bg black

# active window will  :
setw -g monitor-activity on
set -g visual-activity on

# automatic number update of windows:
set -g renumber-windows on

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %