Show Menu
Cheatography

Tmux Cheat Sheet (DRAFT) by

Tmux shortcuts and commands

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Conven­tions

, , ,
Up, Down, Left, Right
, ,
Alt, Ctrl, Shift
a, b, c, <ke­y>
a, b, and c keys, etc.
[Home], [Insert], [<K­ey>]
Home, Insert keys, etc.
{L}
{R}
Click left key of mouse
Click right key of mouse
,
Additionl infomr­ation in note area
This cheat sheet comes from
man tmux
.
See Tmux on Github

Help

?
:list-keys
List all key bindings
:
Start command prompt
Default <pr­efi­x>: + b

Prefix key table

Following sheets show shortcuts and commands under key table of default prefix.
set-option -g prefix "­C-b­"

set-option -g prefix2 "­<your prefix­>"

Buffer

#
:list-­buffer

List the global buffers
-
:delet­e-b­uffer

Delete the most recently added buffer
=
:choos­e-b­uffer

Start buffer mode(as a pane) for choosing one
]
:paste­-buffer

Insert the content of current buffer

Pane

x
:kill-pane
Kill pane
;
:last-pane
Focus at Last one
o
:selec­t-pane
-t :.+
Focus at Next one
, , ,
:selec­t-pane
-U
/
-D
/
-L
/
-R
Focus at Up, Down, Left, Right one
!
:break­-pane
Move this pane to new window
{
:swap-pane -U
Swap position with previous pane
}
:swap-pane -D
Swap position with next pane
+ 1
:selec­t-l­ayout even-h­ori­zontal
Spread out evenly(from left to right)
+ 2
:selec­t-l­ayout even-v­ertical
Spread out evenly(from top to bottom)
+ 3
:selec­t-l­ayout main-h­ori­zontal
1. Large pane is on the top
2. Rest panes are spread on bottom(from left to right)
+ 4
:selec­t-l­ayout main-v­ertical
1. Large pane is on the left
2. Rest panes are spread on right(from top to bottom)
+ 5
:selec­t-l­ayout tiled
Spread out as evenly as possible(rows and columns)
q
:displ­ay-­panes
Display indica­tors(as number) of panes
m
:selec­t-pane -m

M
:selec­t-pane -M
Mark pane

Clear mark of pane
+ , , ,
:resiz­e-pane -U/-D/­-L/-R 5
Resize pane by 5 lines
Up, Down, Left, Right
+ , , ,
:resiz­e-pane -U/-D/­-L/-R
Resize pane by 1 lines
Up, Down, Left, Right
z
:resiz­e-pane -Z
Resize pane to Maximu­m/N­ormal size

Window

&
:kill-­window
Kill window
,
:renam­e-w­indow
Rename window­(pr­ompt)
.
:move-­window
Move window­(pr­ompt)
[0-9]
:selec­t-w­indow -t :=<­N>
Select
<N>
window
'
:selec­t-w­indow -t :%%
Select
<N>
window­(pr­ompt)
l
:last-­window

p
:previ­ous­-window
Select last window

Select previous window
f
:find-­window
Search for the fnmatch(3) pattern in
window names, titles, and visible content
"
:split­-window
Split window vertically
%
:split­-window -h
Split window horizo­ntally
+ o
:rotat­e-w­indow
Rotate panes in window

Client

d
:detac­h-c­lient
Detach client
r
:refre­sh-­client
Refresh current client
+ z
:suspe­nd-­client
Suspend client
i
:displ­ay-­message

-
:show-­mes­sages
Display info of current pane

Show client messages
L
:switc­h-c­lient -l
Switch the current session for client to
Last one
(
:switc­h-c­lient -p
Switch the current session for client to
Previous one
)
:switc­h-c­lient -n
Switch the current session for client to
Next one
t
":clock-mode"
Display a large clock

Session

$
:renam­e-s­ession
(prompt)
Rename session

:choo­se-­buffer

[Up], [Down]
Select previo­us/next buffer
[Enter]
Choose selected buffer
+ s
Search by name
n
Repeat last search
t
Toggle if buffer is tagged
+ t
Tag all buffers
T
Tag no buffers
d, D
Delete select­ed/­tagged buffers
f
Enter a format to filter items
O
Change sort order
v
Toggle preview
q
Exit mode

:choo­se-­client

[Up], [Down]
Select previous/next client
[Enter]
Choose selected client
v
Toggle preview
+ s
Search by name
n
Repeat last search
t
Toggle if client is tagged
+ t
Tag all clients
T
Tag no clients
d, D
Detach selected/tagged clients
x, X
Detach and HUP select­ed/­tagged client
z, Z
Suspend selected/tagged clients
f
Enter a format to filter items
O
Change sort order
q
Exit mode

:choo­se-­tree

[Up], [Down]
Select previo­us/next item
[<], [>]
Scroll list of previews left/right
[Enter]
Choose selected item
+ s
Search by name
n
Repeat last search
t
Toggle if item is tagged
+ t
Tag all items
T
Tag no items
:
Run a command for each tagged item
f
Enter a format to filter items
O
Change sort order
v
Toggle preview
q
Exit mode
 

Copy Mode

[
Start copy mode
[PageUp]
Start copy mode and scroll one page up
q
+ c
Quit copy mode

Vi Copy Mode

Following sheets show keys in Vi edit mode
set-wi­ndo­w-o­ption mode-keys vi
<N> - As key 0-9 for times of repeating the shortcuts
E.g.:
"­5j"
- Move the cursor for left by 5 times
<ch> - Any printable character
<wo­rd>
- Continuous characters of
[_0-9a­-zA-Z]

<WO­RD>
- Continuous non-blank characters
#line - As integer value for line number. E.g.:
"­13"

Copy/S­ele­ction

[Space]
Begin selection
v, V
Rectan­gle­/Li­ne-wise selection
o
Switch other end in selected area
[Enter]
+ j
Copy selection
A
Append selection to copied buffer
D
Copy to end of line(from current position)
[Esc]
Clear selection
- Will quit the copy mode after the action

Search

/, ?
Start Search
<te­xt>
forwar­d/b­ackward
n, N
<N> Search next/r­everse

Cursor


k, j, h, l
, , ,
+ h
[Backs­pace]
<N> Move cursor for:
Up, Down, Left, Right

Left

^
0
$
Move cursor to(current line):
First non-blank char
First char
Last char

f<ch>, t<ch>
F<ch>, T<ch>
<N> Move cursor to(current line):
Next <ch>/<ch>
Previous <ch­>/<­ch>
;, ,

<N> Repeat the latest
"­f/t­<ch­>"
in
same/o­pposite direction

w, W
e, E
b, B
{, }
<N> Move cursor to:
Next beginning of
<wo­rd>­/<W­ORD>

Next end of
<wo­rd>­/<W­ORD>

Previous beginning of
<wo­rd>­/<W­ORD>

Previo­us/Next
paragraph

H
M
L
<N> Move cursor to(current screen):
Top(Head)
Middle
Bottom(Low)

Screen Scroll

+ b, + f
[PageUp], [PageDown]
<N> Page Up/Down
+ d, + u
+ , +
<N> Half Page Up/Down
+ y
+
+ e
+
<N> One line Up

<N> One line Down
: #line
Goto "­#li­ne" line
g
G
Top of history
Bottom of history

Emacs Copy Mode

Following sheets show keys in Emacs edit mode
set-wi­ndo­w-o­ption mode-keys emacs

Cancel mode: [Esc]
<N> - As key " + 0-9" for times of repeating the shortcuts
E.g.:
"+5 +b"
- Move the cursor for left by 5 times
<ch> - Any printable character
#line - As integer value for line number. E.g.:
"­13"

Copy/S­ele­ction

+ [Space]
Begin selection
+ w
+ w
Copy selection
+ k
Copy to end of line(from current position)
+ g
Clear selection
- Will quit the copy mode after the action

Search

+ r, + s
Start Search
<te­xt>
backwa­rd/­forward
R
Rectangle selection
n, N
<N> Search next/r­everse

Cursor


+ p, + n
,
+ b, + f
,
<N> Move cursor for:
Up, Down

Left, Right

+ m
+ a
[Home]
+ e
[End]
Move cursor to(current line):
First non-blank char
First char

Last char

f<ch>, t<ch>
F<ch>, T<ch>
<N> Move cursor to(current line):
Next <ch>/<ch>
Previous <ch­>/<­ch>
;, ,

<N> Repeat the latest
"­f/t­<ch­>"
in
same/o­pposite direction

+ f
+ b
+ {, + }
<N> Move cursor to:
Next end of
<wo­rd>

Previous
<wo­rd>

Next/P­revious
paragraph

+ R, + r
<N> Move cursor to(current screen):
Top/Middle

Screen Scroll

[PageUp]
+ v
[Space]
[PageDown]
+ v
<N> Page up

<N> Page down
+ , +
<N> Half Page Up/Down
+ , +
<N> One line Up/Down
g #line
Goto "­#li­ne" line
+ <
+ >
Top of history
Bottom of history

Target pane

<se­ssi­on>­:<w­ind­ow>.<p­ane>
Full name
Specical token:
! ({last})
+ ({next})
- ({previous})

Last pane
Next window
Previous window
Offset
+<N>, -<N>

Next/P­revious offsets of pane
tokens(relative position):
{up-of}
{down-of}
{left-of}
{right-of}

Above
Below
to the Left
to the Right
of the current pane
tokens(absolute position):
{top}
{bottom}
{left}
{right}
{top-left}
{top-r­ight}
{botto­m-left}
{botto­m-r­ight}

The top
The bottom
The leftmost
The rightmost
The top-left
The top-right
The bottom­-left
The bottom­-right
pane

Target window

<se­ssi­on>­:<w­ind­ow>
Full name
1. As a specical token:
^ ({start})
$ ({end})
! ({last})
+ ({next})
- ({previous})

Lowest­-Nu­mbered window
Highes­t-N­umbered window
Last window
Next window
Previous window
2. A window index
"session1:0", "session1:1"
3. A Window ID(prefixed with @)
"@1", "@2"
4. An exact window name
"sessio­n2:help", "sessio­n2:­devs-1"
5. The start of a window name
"sessio­n3:he", "sessio­n3:devs"
6. As an fnmatch(3) pattern for matching the window name
"sessio­n4:he*", "sessio­n4:­devs-?"
:list-­windows
(
lsw
)
List windows
".:<­tar­get­-wi­ndo­w>", ":<t­arg­et-­win­dow>", "<ta­rge­t-w­ind­ow>" uses current session

Target session

1. A session ID(prefixed with $)
"$0", "$1", "$2"
2. An exact name
"Work", "Monitor-S1", "Monitor-S2"
3. The start of session name
"Wo", "Monitor"
4. An fnmatch(3) pattern for matching session name
"Monito­r*", "Monitor-S?"
Exact matching by prefixed with
=
"=Work", "=Monit­or-S2"
:list-­ses­sions
(
ls
)
List all sessions
:has-s­ession -t <ta­rge­t-s­ess­ion>
(
has
)
Checks if a session is existing

Target client

Name is normally as pty(7) file
"/dev/pty0", "/dev/pts/1"
:list-­clients
(
:lsc
)
List clients