(CTRL-x means ctrl+x, ALT-x means alt+x)
The default prefix is CTRL-b. If you (or your muscle memory) prefer CTRL-a, you need to add this to ~/.tmux.conf
:
# remap prefix to Control + a
set -g prefix CTRL-b
# bind 'CTRL-b CTRL-b' to type 'CTRL-b'
bind CTRL-b send-prefix
unbind CTRL-b
Session is a set of windows, plus a notion of which window is current.
Window is a single screen covered with panes. (Once might compare it to a ‘virtual desktop’ or a ‘space’.)
Pane is a rectangular part of a window that runs a specific command, e.g. a shell.
Display a list of keyboard shortcuts:
CTRL-b ?
Navigate using Vim or Emacs shortcuts, depending on the value of mode-keys
. Emacs is the default, and if you want Vim shortcuts for help and copy modes (e.g. j, k, CTRL-u, CTRL-d), add the following line to ~/.tmux.conf
:
setw -g mode-keys vi
Any command mentioned in this list can be executed as tmux something
or CTRL-b :something
(or added to ~/.tmux.conf
).
Creating a session:
tmux new-session -s work
Create a new session that shares all windows with an existing session, but has its own separate notion of which window is current:
tmux new-session -s work2 -t work
Attach to a session:
tmux attach -t work
Detach from a session: CTRL-b d
.
Switch between sessions:
CTRL-b ( previous session
CTRL-b ) next session
CTRL-b L ‘last’ (previously used) session
CTRL-b s choose a session from a list
Other:
CTRL-b $ rename the current session
CTRL-b
Create a window:
CTRL-b c create a new window
Switch between windows:
CTRL-b 1 ... switch to window 1, ..., 9, 0
CTRL-b 9
CTRL-b 0
CTRL-b p previous window
CTRL-b n next window
CTRL-b l ‘last’ (previously used) window
CTRL-b w choose window from a list
Switch between windows with a twist:
CTRL-b ALT-n next window with a bell, activity or
content alert
CTRL-b ALT-p previous such window
Other:
CTRL-b , rename the current window
CTRL-b & kill the current window
Creating a new pane by splitting an existing one:
CTRL-b " split vertically (top/bottom)
CTRL-b % split horizontally (left/right)
Switching between panes:
CTRL-b left go to the next pane on the left
CTRL-b right (or one of these other directions)
CTRL-b up
CTRL-b down
CTRL-b o go to the next pane (cycle through all of them)
CTRL-b ; go to the ‘last’ (previously used) pane
Moving panes around:
CTRL-b { move the current pane to the previous position
CTRL-b } move the current pane to the next position
CTRL-b CTRL-o rotate window ‘up’ (i.e. move all panes)
CTRL-b ALT-o rotate window ‘down’
CTRL-b ! move the current pane into a new separate
window (‘break pane’)
CTRL-b :move-pane -t :3.2
split window 3's pane 2 and move the current pane there
Resizing panes:
CTRL-b ALT-up, CTRL-b ALT-down, CTRL-b ALT-left, CTRL-b ALT-right
resize by 5 rows/columns
CTRL-b CTRL-up, CTRL-b CTRL-down, CTRL-b CTRL-left, CTRL-b CTRL-right
resize by 1 row/column
Applying predefined layouts:
CTRL-b ALT-1 switch to even-horizontal layout
CTRL-b ALT-2 switch to even-vertical layout
CTRL-b ALT-3 switch to main-horizontal layout
CTRL-b ALT-4 switch to main-vertical layout
CTRL-b ALT-5 switch to tiled layout
CTRL-b space switch to the next layout
Other:
CTRL-b x kill the current pane
CTRL-b q display pane numbers for a short while
Force a reload of the config file on CTRL-b r:
unbind r
bind r source-file ~/.tmux.conf
This was forked from https://gist.github.com/andreyvit/2921703, I just changed the shortcut back to the default.