Skip to content

Instantly share code, notes, and snippets.

@larribas
Last active January 5, 2022 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save larribas/fc5cd8c4713be533d854c81c3f74db87 to your computer and use it in GitHub Desktop.
Save larribas/fc5cd8c4713be533d854c81c3f74db87 to your computer and use it in GitHub Desktop.
Tmux Cheat Sheet

Tmux Cheat Sheet

Sessions

Start a new session tmux || tmux new -s name || :new

Attach to last session tmux a || tmux a -t name

Show all sessions tmux ls || Prefix + s

Kill session by name tmux kill-session -t name

Kill all but the current session tmux kill-session -a

Rename session Prefix + $

Detach from session Prefix + d

Move to previous/next session Prefix + ( || Prefix + )

See all defined keybindings Prefix + ?

Windows

Create window Prefix + c

Rename window Prefix + ,

Close window Prefix + &

Go to (previous/next/some) window Prefix + p || Prefix + n || Prefix + 0..9

Panes

Split pane vertically/horizontally Prefix + | || Prefix + -

Move the current pane left/right Prefix + { || Prefix + }

Toggle between pane layouts Prefix + Spacebar

Go to a pane by direction Prefix + Arrow key

Resize current pane height/width Prefix && Arrow key

Show pane numbers(type the number to goto that pane) Prefix + q

Toggle pane zoom Prefix + z

Convert pane into a window Prefix + !

Close pane Prefix + x

Copy mode

Enter copy mode Prefix + [

While on copy mode...

Quit mode q

Go to top line g

Go to bottom line G

Move cursor (like vim) h || j || k || l

Search forward /

Search backward ?

Next/previous keyword occurance n || N

Start selection Spacebar

Copy selection Enter

Clear selection Esc

Buffers

Paste contents of buffer_0 Prefix + ]

Display buffer_0 contents :show-buffer

Copy entire visible contents of pane to a buffer :capture-pane

Show all buffers :list-buffers

Show all buffers and paste selected :choose-buffer

Save buffer contents to buf.txt :save-buffer buf.txt

Delete buffer_1 :delete-buffer -b 1

Tmux Resurrect

Save sessions Prefix + Ctrl-s

Restore sessions Prefix + Ctrl-r

Tmux Copycat

Search on the buffer (all regexes) Prefix + /

Search matching files Prefix + Ctrl-f

Search matching git status files Prefix + Ctrl-g

Search matching urls Prefix + Ctrl-u

Search matching numbers Prefix + Ctrl-d

Jump between results N || n

Tmux Yank

Copies text from the command line to clipboard prefix + y

Copy pane current working directory to clipboard prefix + Y

Copy mode bindings

copy selection to system clipboard y

"put" selection - equivalent to copying a selection, and pasting it to the command line Y (shift-y)

Tmux Open

"open" a highlighted selection with the system default program o

Open a highlighted selection with the $EDITOR Ctrl-o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment