jykim16
2/2/2018 - 12:07 AM

tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

list all tmux sessions:

tmux ls

start new with session name:

tmux new -s myname

attach to named:

tmux a -t myname

kill session:

tmux kill-session -t myname

Kill all the tmux sessions:

tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill

Use prefix ctrl+b, then:

Sessions

d  detach
t  big clock
?  list shortcuts
:  prompt
s  list sessions
$  name session

Windows (tabs)

c  create window
w  list windows
n  next window
p  previous window
f  find window
,  name window
&  kill window

Panes (splits)

%  vertical split
"  horizontal split

o  swap panes
q  show pane numbers
x  kill pane
+  break pane into window (e.g. to select text by mouse to copy)
-  restore pane from window
⍽  space - toggle between layouts
<prefix> q (Show pane numbers, when the numbers show up type the key to goto that pane)
<prefix> { (Move the current pane left)
<prefix> } (Move the current pane right)
<prefix> z toggle pane zoom

View

Resizing Panes

You can also resize panes if you don’t like the layout defaults. I personally rarely need to do this, though it’s handy to know how. Here is the basic syntax to resize panes:

PREFIX : resize-pane -D (Resizes the current pane down)
PREFIX : resize-pane -U (Resizes the current pane upward)
PREFIX : resize-pane -L (Resizes the current pane left)
PREFIX : resize-pane -R (Resizes the current pane right)
PREFIX : resize-pane -D 20 (Resizes the current pane down by 20 cells)
PREFIX : resize-pane -U 20 (Resizes the current pane upward by 20 cells)
PREFIX : resize-pane -L 20 (Resizes the current pane left by 20 cells)
PREFIX : resize-pane -R 20 (Resizes the current pane right by 20 cells)
PREFIX : resize-pane -t 2 20 (Resizes the pane with the id of 2 down by 20 cells)
PREFIX : resize-pane -t -L 20 (Resizes the pane with the id of 2 left by 20 cells)

Copy mode:

PREFIX [ copy mode
ENTER exit copy mode

copying in mouse mode - hold fn key while copying

How to scroll without mouse

Ctrl-b then [ 
then you can use your normal navigation keys to scroll around (eg. Up Arrow or PgDn). 
Press q to quit scroll mode
Functionvi
Half page downC-d
Half page upC-u
Next pageC-f
Previous pageC-b
Scroll downC-Down or C-e
Scroll upC-Up or C-y
Search againn
Search again in reverseN
Search backward?
Search forward/