tmux cheat sheet

  • (C-x means ctrl+x, M-x means alt+x)

Prefix key

default prefix is C-b

Sessions, windows, panes

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.

Getting help

C-b ?

Managing split panes

C-b “          split vertically (top/bottom)
C-b %          split horizontally (left/right)

Switching between panes:
C-b left       go to the next pane on the left
C-b right      (or one of these other directions)
C-b up
C-b down
C-b o          go to the next pane (cycle through all of them)
C-b ;          go to the ‘last’ (previously used) pane

Resizing panes:
C-b C-up, C-b C-down, C-b C-left, C-b C-right

Applying predefined layouts:

C-b M-1        switch to even-horizontal layout
C-b M-2        switch to even-vertical layout
C-b M-3        switch to main-horizontal layout
C-b M-4        switch to main-vertical layout
C-b M-5        switch to tiled layout
C-b space      switch to the next layout

Other:
C-b x          kill the current pane
C-b q          display pane numbers for a short while

Moving panes around:
C-b {          move the current pane to the previous position
C-b }          move the current pane to the next position
C-b C-o        rotate window ‘up’ (i.e. move all panes)
C-b M-o        rotate window ‘down’
C-b !          move the current pane into a new separate window (‘break pane’)
C-b :move-pane -t :3.2    split window 3’s pane 2 and move the current pane there

Managing windows

C-b c          create a new window
C-b 1 …      switch to window 1, …, 9, 0
C-b 9
C-b 0
C-b p          previous window
C-b n          next window
C-b l          ‘last’ (previously used) window
C-b w          choose window from a list
Switch between windows with a twist:
C-b M-n        next window with a bell, activity or content alert
C-b M-p        previous such window
C-b ,          rename the current window
C-b &          kill the current window

Managing sessions

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: C-b d.

Switch between sessions:
C-b (          previous session
C-b )          next session
C-b L          ‘last’ (previously used) session
C-b s          choose a session from a list

Other:
C-b $          rename the current session

.tmux.conf im Userverzeichnis

# start with window 1 (instead of 0)
set -g base-index 1