Note: This is customized for my own configuration. See my dotfiles repository for my tmux.conf (& local).
c new window
w list windows
f find window
, name window
& kill window
% vertical split
" horizontal split
z zoom (unzoom) current pane (maximize)
o swap panes
q show pane numbers
x kill pane
+ break pane into window (e.g. to select text by mouse to copy)
- restore pane from window
⍽ space - toggle between layouts
PREFIX q (Show pane numbers, when the numbers show up type the key to goto that pane)
PREFIX { (Move the current pane left)
PREFIX } (Move the current pane right)
You can also resize panes if you don’t like the layout defaults. I personally rarely need to do this, though it’s handy to know how. Here is the basic syntax to resize panes:
PREFIX : resize-pane (By default it resizes the current pane down)
PREFIX : resize-pane -U (Resizes the current pane upward)
PREFIX : resize-pane -L (Resizes the current pane left)
PREFIX : resize-pane -R (Resizes the current pane right)
PREFIX : resize-pane 20 (Resizes the current pane down by 20 cells)
PREFIX : resize-pane -U 20 (Resizes the current pane upward by 20 cells)
PREFIX : resize-pane -L 20 (Resizes the current pane left by 20 cells)
PREFIX : resize-pane -R 20 (Resizes the current pane right by 20 cells)
PREFIX : resize-pane -t 2 20 (Resizes the pane with the id of 2 down by 20 cells)
PREFIX : resize-pane -t -L 20 (Resizes the pane with the id of 2 left by 20 cells)
Pressing PREFIX `
places us in Copy mode.
Note: There are two clipboards at play. There's the paste buffer, which is tmux only, and there's the system clipboard. When copying, use PREFIX y
again to yank to the system clipboard. For the opposite, to paste the content of the system clipboard, overwriting anything currently in the paste buffer, you can use PREFIX C-p
(as opposed to just p
to paste the buffer).
Function vi
Back to indentation ^
Clear selection Escape
Copy selection Enter
Cursor down j
Cursor left h
Cursor right l
Cursor to bottom line L
Cursor to middle line M
Cursor to top line H
Cursor up k
Delete entire line d
Delete to end of line D
End of line $
Goto line :
Half page down C-d
Half page up C-u
Next page C-f
Next word w
Paste buffer p
Previous page C-b
Previous word b
Quit mode q
Scroll down C-Down or J
Scroll up C-Up or K
Search again n
Search backward ?
Search forward /
Start of line 0
Start selection v
start new:
tmux
start new with session name:
tmux new -s myname
attach:
tmux a # (or at, or attach)
attach to named:
tmux a -t myname
list sessions:
tmux ls
kill session:
tmux kill-session -t myname
In tmux, hit the prefix ctrl+b
(my modified prefix is ctrl+a) and then:
:new<CR> new session
s list sessions
$ name session
d detach
t big clock
? list shortcuts
: prompt
r reload config
# Mouse support - set to on if you want to use the mouse
* setw -g mode-mouse off
* set -g mouse-select-pane off
* set -g mouse-resize-pane off
* set -g mouse-select-window off
# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
# Center the window list
set -g status-justify centre
# Maximize and restore a pane
unbind Up bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp