Cheat Sheets
Tmux

Tmux CLI

New session {.row-span-2}

Start a new session

$ tmux

Start a new named session

$ tmux new -s myname

Show all sessions

$ tmux ls

Attach session

Attach to last session

$ tmux a

Attach to named

$ tmux a -t myname

Kill session {.row-span-2}

Kill a session by name

$ tmux kill-ses -t myname

Kill sessions but the current

$ tmux kill-ses -a

Kill sessions but 'myname'

$ tmux kill-ses -a -t myname

Tmux help

$ tmux info

Config

Reload config

$ tmux source-file ~/.tmu­x.conf

Show config

$ tmux show-options -g

Copy Mode

CommandDescription
Ctrl+b [Enter copy mode
<Space>Start selection
EnterCopy selection
qQuit copy mode
Ctrl+b ]Paste contents of buffer_0
{.shortcuts}

Mainly works like selecting text in Vim

Tmux shortcuts

Getting started {.secondary}

ShortcutsDescription
Ctrl+b ?List all shortcuts
{.shortcuts .show-header}


Show every session, window, pane, etc.

$ tmux info

Panes (Splits) {.row-span-2}

ShortcutsDescription
Ctrl+b " / %Split Horiz/Vert
Ctrl+b !Pane -> Window
Ctrl+b xKill pane
Ctrl+b <Arrow>Navigate panes
Ctrl+b <Space>Toggle layouts
Ctrl+b { / }Move to Left/Right
Ctrl+b oGo to next panes
Ctrl+b zToggle full-screen
Ctrl+b ;Toggle Last pane
Ctrl+b qShow numbers
Ctrl+b q 0...9Go to # pane
{.shortcuts}

Window (Tabs) {.row-span-2}

--
Ctrl+b cCreate window
Ctrl+b p / nPrevious/Next window
Ctrl+b " / %Split Horiz/Vert
Ctrl+b wList window
Ctrl+b ,Rename window
Ctrl+b fFind window
Ctrl+b lLast window
Ctrl+b .Move window
Ctrl+b &Close window
Ctrl+b 0...9Go to # window
{.shortcuts}

Session (Set of Windows)

--
Ctrl+b dDetach from session
Ctrl+b sShow all sessions
Ctrl+b $Rename session
Ctrl+b ( / )Previous/Next session
{.shortcuts}

Tmux Command Mode

Usage {.secondary}

CommandDescription
Ctrl+b :Enter command mode
{.shortcuts}

Resizing

CommandDescription
resize-pane -D 20Resize down
resize-pane -U 20Resize up
resize-pane -L 20Resize left
resize-pane -R 20Resize right

Listing

CommandDescription
list-keysAll commands
list-panesAll panes
list-windowsAll Windows

Copying

CommandDescription
list-buffersList all buffers
show-bufferShow #0 contents
capture-paneCopy of pane
choose-bufferShow and paste
save-buffer a.txtSave to file
delete-buffer -b 1Delete buffer 1

Setting

CommandDescription
set -g OPTIONSet for all sessions
setw -g OPTIONSet for all windows
setw -g mode-keys viEnable vi-mode
set -g prefix C-aSet prefix

Misc

CommandDescription
swap-pane -s 3 -t 1Swap pane
swap-window -t -1Move to left
setw synchronize-panesSync Panes
join-pane -t :#Join pane