tmuxcheatsheet.org

The ultimate interactive guide to terminal multiplexing.Search, copy, and customize your terminal workflow.

Set your prefix or use default:
sessions
tmux new

Start a new session

tmux new-sessiontmux
tmux new
sessions
tmux new -s [name]

Start a new named session

tmux new-session -s [name]
tmux new -s [name]
sessions
tmux new -A -s [name]

Attach to session or create it if missing

tmux new-session -A -s [name]
tmux new -A -s [name]
sessions
tmux a

Attach to last session

tmux attmux attachtmux attach-session
tmux a
sessions
tmux a -t [name]

Attach to a named session

tmux at -t [name]tmux attach -t [name]tmux attach-session -t [name]
tmux a -t [name]
sessions
tmux ls

List all sessions

tmux list-sessions
tmux ls
sessions
tmux kill-ses -t [name]

Kill a named session

tmux kill-session -t [name]
tmux kill-ses -t [name]
sessions
tmux kill-ses -a

Kill all sessions except current

tmux kill-session -a
tmux kill-ses -a
sessions
tmux kill-ses -a -t [name]

Kill all sessions except named

tmux kill-session -a -t [name]
tmux kill-ses -a -t [name]
sessions
tmux kill-server

Stop tmux server & all sessions

tmux kill-server
sessions
tmux rename-session -t [old] [new]

Rename a session via CLI

tmux rename-session -t [old] [new]
sessions
tmux new -s [session] -n [window]

New session with named window

tmux new -s [session] -n [window]
sessions
Ctrl-bd

Detach from current session

Ctrl-b + d
sessions
Ctrl-bs

List & switch sessions

Ctrl-b + s
sessions
Ctrl-b$

Rename current session

Ctrl-b + $
sessions
Ctrl-b(

Switch to previous session

Ctrl-b + (
sessions
Ctrl-b)

Switch to next session

Ctrl-b + )
sessions
Ctrl-bL

Switch to last session (previously active)

Ctrl-b + L
sessions
Ctrl-b:

Enter tmux command prompt

Ctrl-b + :
sessions
: attach -d

Detach all other clients from session

: attach -d
windows
Ctrl-bc

Create a new window

Ctrl-b + c
windows
Ctrl-b,

Rename current window

Ctrl-b + ,
windows
Ctrl-bw

List all windows

Ctrl-b + w
windows
Ctrl-bn

Next window

Ctrl-b + n
windows
Ctrl-bp

Previous window

Ctrl-b + p
windows
Ctrl-bl

Toggle last active window

Ctrl-b + l
windows
Ctrl-bf

Find window by name

Ctrl-b + f
windows
Ctrl-b0-9

Switch to window by number

Ctrl-b + 0-9
windows
Ctrl-b&

Kill current window

Ctrl-b + &
windows
Ctrl-b.

Move window to a different index

Ctrl-b + .
windows
: swap-window -s 2 -t 1

Swap window positions

: swap-window -s 2 -t 1
windows
: move-window -r

Renumber windows (remove gaps)

: move-window -r
windows
: move-window -s src:win -t dst

Move window to another session

: move-window -s src:win -t dst
panes
Ctrl-b"

Split pane horizontally

Ctrl-b + "
panes
Ctrl-b%

Split pane vertically

Ctrl-b + %
panes
Ctrl-bo

Go to next pane

Ctrl-b + o
panes
Ctrl-b;

Toggle last active pane

Ctrl-b + ;
panes
Ctrl-bx

Kill current pane

Ctrl-b + x
panes
Ctrl-bz

Toggle pane zoom (fullscreen)

Ctrl-b + z
panes
Ctrl-b!

Break pane into new window

Ctrl-b + !
panes
Ctrl-b{

Move pane left

Ctrl-b + {
panes
Ctrl-b}

Move pane right

Ctrl-b + }
panes
Ctrl-bArrow Keys

Navigate between panes

Ctrl-b + Arrow Keys
panes
Ctrl-bCtrl+Arrow Keys

Resize pane by 1 cell

Ctrl-b + Ctrl+Arrow Keys
panes
Ctrl-bAlt+Arrow Keys

Resize pane by 5 cells

Ctrl-b + Alt+Arrow Keys
panes
Ctrl-bSpace

Cycle pane layouts

Ctrl-b + Space
panes
Ctrl-bm

Mark pane

Ctrl-b + m
panes
Ctrl-bM

Clear mark

Ctrl-b + M
panes
Ctrl-bq

Show pane numbers

Ctrl-b + q
panes
Ctrl-bt

Show clock

Ctrl-b + t
panes
: join-pane -s 2 -t 1

Merge window into panes

: join-pane -s 2 -t 1
panes
: setw synchronize-panes

Toggle input broadcast to all panes

: setw synchronize-panes
copy-mode
Ctrl-b[

Enter copy mode

Ctrl-b + [
copy-mode
Ctrl-b]

Paste from buffer

Ctrl-b + ]
copy-mode
Space

Start selection

Space
copy-mode
Enter

Copy selection & exit

Enter
copy-mode
Esc

Cancel selection

Esc
copy-mode
q

Exit copy mode

q
copy-mode
Ctrl-bPageUp

Enter copy mode & scroll up

Ctrl-b + PageUp
copy-mode
PageDown

Scroll down (in copy mode)

PageDown
copy-mode
Arrow Keys

Move cursor (in copy mode)

Arrow Keys
copy-mode
h / j / k / l

Vi cursor navigation

h / j / k / l
copy-mode
w / b

Move forward / backward by word

w / b
copy-mode
/

Search forward

/
copy-mode
?

Search backward

?
copy-mode
n / N

Next / previous match

n / N
copy-mode
g / G

Go to top / bottom

g / G
copy-mode
: show-buffer

Show buffer contents

: show-buffer
copy-mode
: list-buffers

List all buffers

: list-buffers
copy-mode
: choose-buffer

Select buffer to paste

: choose-buffer
copy-mode
: save-buffer file.txt

Export buffer to file

: save-buffer file.txt
copy-mode
: setw -g mode-keys vi

Enable vi keybindings

: setw -g mode-keys vi
misc
Ctrl-b?

Show all keybindings

Ctrl-b + ?
misc
tmux lsk

List all shortcuts (CLI)

tmux list-keys
tmux lsk
misc
Ctrl-b~

Show messages

Ctrl-b + ~
misc
tmux source ~/.tmux.conf

Reload config file

tmux source-file ~/.tmux.conf
tmux source ~/.tmux.conf
misc
Ctrl-b

Default Prefix key

Ctrl-b
misc
Ctrl-br

Reload config (if bound)

Ctrl-b + r
misc
Ctrl-bi

Show window info

Ctrl-b + i
misc
: set mouse on

Enable mouse mode

: set mouse on
misc
: set -g OPTION

Set option for all sessions

: set -g OPTION
misc
: setw -g OPTION

Set option for all windows

: setw -g OPTION
misc
tmux info

Show all sessions, windows & panes info

tmux info

01. The Prefix

Most commands in tmux are preceded by a prefix key. Your current prefix is Ctrl-b.

02. Command Mode

Press Prefix + : to enter command mode where you can type any tmux command directly.

03. Persistence

The power of tmux is that sessions persist even if you close your terminal or lose your connection.