Cheat sheets /

tmux cheat sheet

Sessions that survive a dropped connection, and panes for everything else. Key bindings use the default prefix, Ctrl-b: press it, let go, then press the next key.

Download all 28 for Snippet Keeper Get Snippet Keeper

In Snippet Keeper, click Import at the bottom of the sidebar and choose the file. They land in your tmux app, and ones you already have are skipped. The highlighted parts become fill-in fields: type a value (or pick one), and the finished command is on your clipboard.

Sessions

Start a named session

tmux new -s name

List sessions

tmux ls

Attach to a session

tmux attach -t name

End a session

tmux kill-session -t name

Detach

Everything keeps running; attach again later.

Ctrl-b d

Switch sessions

Ctrl-b s

Rename the session

Ctrl-b $

Windows

New window

Ctrl-b c

Next or previous window

Ctrl-b n / Ctrl-b p

Go to a window by number

Ctrl-b number

Pick a window from a list

Ctrl-b w

Rename the window

Ctrl-b ,

Close the window

Ctrl-b &

Panes

Split side by side

Ctrl-b %

Split top and bottom

Ctrl-b "

Move between panes

Ctrl-b ←↑→↓

Zoom a pane (toggle)

Ctrl-b z

Close a pane

Ctrl-b x

Cycle layouts

Ctrl-b Space

Show pane numbers

Ctrl-b q

Turn a pane into its own window

Ctrl-b !

Resize a pane

Keep holding Ctrl and press the arrow again to keep resizing.

Ctrl-b Ctrl-←↑→↓

Copy mode

Scroll back / enter copy mode

Arrow keys or Page Up to scroll; q to leave.

Ctrl-b [

Paste what you copied

Ctrl-b ]

Config

Turn on the mouse

Add to ~/.tmux.conf. Click panes, drag borders, scroll.

set -g mouse on

Number windows from 1

set -g base-index 1

Split in the current folder

bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"

Reload the config

tmux source-file ~/.tmux.conf

Keep these one keystroke away.

Snippet Keeper is a Mac app for the commands you keep looking up. Press ⌥⇧Space in any app, type a few letters, fill in the blanks, and it’s on your clipboard.

Snippet Keeper asking for the values in a kubectl command before copying it