kota's memex

book

https://leanpub.com/the-tao-of-tmux/read

cheatsheet

gemini://darknesscode.xyz/linux/tmux-cheatsheet.gmi

Sessions

tmux new -s mysession
:new -s mysession

Start a new session with the name mysession

tmux kill-ses -t mysession
tmux kill-session -t mysession

kill/delete session mysession

tmux kill-session -a

kill/delete all sessions but the current

tmux kill-session -a -t mysession

kill/delete all sessions but mysession

<mod> $

Rename session

<mod> d

Detach from session

: attach -d

Detach others on the session (Maximize window by detach other clients)

tmux ls
tmux list-sessions
<mod> s

Show all sessions

tmux a
tmux at
tmux attach
tmux attach-session

Attach to last session

tmux a -t mysession
tmux at -t mysession
tmux attach -t mysession
tmux attach-session -t mysession

Attach to a session with the name mysession

<mod> (

Move to previous session

<mod> )

Move to next session

Windows

tmux new -s mysession -n mywindow

start a new session with the name mysession and window mywindow

<mod> c

Create window

<mod> ,

Rename current window

<mod> &

Close current window

<mod> p

Previous window

<mod> n

Next window

<mod> 0 ... 9

Switch/select window by number

: swap-window -s 2 -t 1

Reorder window, swap window number 2(src) and 1(dst)

: swap-window -t -1

Move current window to the left by one position

Panes

<mod> ;

Toggle last active pane

<mod> %

Split pane horizontally

<mod> "

Split pane vertically

<mod> {

Move the current pane left

<mod> }

Move the current pane right

: setw synchronize-panes

Toggle synchronize-panes(send command to all panes)

<mod> Spacebar

Toggle between pane layouts

<mod> o

Switch to next pane

<mod> q

Show pane numbers

<mod> q 0 ... 9

Switch/select pane by number

<mod> z

Toggle pane zoom

<mod> !

Convert pane into a window

<mod> +
<mod> Ctrl +
<mod> +
<mod> Ctrl +

Resize current pane height(holding second key is optional)

<mod> +
<mod> Ctrl +
<mod> +
<mod> Ctrl +

Resize current pane width(holding second key is optional)

<mod> x

Close current pane

Copy Mode

: setw -g mode-keys vi

use vi keys in buffer

<mod> [

Enter copy mode

<mod> PgUp

Enter copy mode and scroll one page up

q

Quit mode

g

Go to top line

G

Go to bottom line

h

Move cursor left

j

Move cursor down

k

Move cursor up

l

Move cursor right

w

Move cursor forward one word at a time

b

Move cursor backward one word at a time

/

Search forward

?

Search backward

n

Next keyword occurance

N

Previous keyword occurance

Spacebar

Start selection

Esc

Clear selection

Enter

Copy selection

<mod> ]

Paste contents of buffer_0

: show-buffer

display buffer_0 contents

: capture-pane

copy entire visible contents of pane to a buffer

: list-buffers

Show all buffers

: choose-buffer

Show all buffers and paste selected

: save-buffer buf.txt

Save buffer contents to buf.txt

: delete-buffer -b 1

delete buffer_1

Misc

<mod> :

Enter command mode

: set -g OPTION

Set OPTION for all sessions

: setw -g OPTION

Set OPTION for all windows

: set mouse on

Enable mouse mode

Help

tmux list-keys
: list-keys
<mod> ?

List key bindings(shortcuts)

tmux info

Show every session, window, pane, etc...