Tmux Quick Guidance

1. Tmux Configuration

1.1 ~/.tmux.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# set prefix2 to Ctrl+Space
set -g prefix2 C-Space
# use | and - to split the windows
unbind '"'
unbind '%'
bind - split-window -v
bind | split-window -h
# use vi keys in buffer
setw -g mode-keys vi
set -g mouse on
set -g history-limit 20000
set -g default-terminal "screen-256color"
# start windows and panes at 0
set -g base-index 0
setw -g pane-base-index 0
# set re-number windows
set -g renumber-windows on
# set foreground/background style for active window
setw -g window-status-current-style "fg=white bg=black bold"
# set bind key "r" to reload configuration file
bind r source-file ~/.tmux.conf \; display "Reloaded!"

1.2 ~/.tmux.conf.local

1
tmux_conf_copy_to_os_clipboard=true

2. Tmux Shell Commands

Action Shell Command
New session % tmux
New session with a name % tmux -s [name]
List sessions % tmux ls
Attach to last session % tmux a
Attach to session with a name % tmux a -t [name]

3. Daily Commands

Action Command (prefix + …)
New session :new
New window c
New pane (horizontal) -
New pane (vertical) |
Rename session :rename -T [name]
Rename window ,
Rename pane :selectp -T [name]
Show all sessions s
List/preview windows w
Select window by number 0-9
Select previous window p
Select next window n
Toggle last active window l
Move to previous session (
Move to next session )
Detatch from session d