My personal tmux cheatsheet 2020-11-07

Every now and then I am using tmux on my remote servers to manage my session. Because I notoriously forget all the finnicky key combinations, I wrote down the (for me) most important ones.

All key combinations start with Ctrl-b, which is indicated by the ^b shortcut in the tables below.

Sessions

cmd Function
tmux Start a new tmux session
tmux ls Lists running sessions
tmux a Connects to the first existing session
tmux a -t x Connects to the session named/with id x

Panes (aka split views)

Keys Function
^b% Splits the actual pane horizontally
^b" Splits the actual pane vertically
^bq Show pane numbers
^b→↓←↑ go to the pane to the right/down/left/up
^bo go to the next pane (cycle)
^bx kill current pane

Windows

Keys Function
^bw List windows
^bc Create new window
^b0 ... go to Window 0 ...
^bp go to the previous window
^bn go to the next window
^b, Rename current window
^b& Kill current window

Scolling, Copying

Keys Function
^b:set-window-option mode-keys vi Set window key mode to vi, which is what I REALLY want
^b:set -g mouse on enable mouse scroll mode
^b[ Enter copy/scroll mode
in copymode:
^u half page up (like in `vi)
^d half page down (like in `vi)
shift-j one line down
shift-k one line up
/ search forward
? search backward
q exit copy/scroll mode
Select, copy text:
<space> start text mark mode
(use vim movements to select)<enter> mark and copy text
back in normal mode:
^b] paste text

Enable mouse scrolling

# in ~/.tmux.conf:
set -g mouse on

within tmux:

^b:set -g mouse on

Exit

Keys Function
^bd Detach from tmux session (keeps session alive)