Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TMUX cheat sheet
# Use vi default bind-keys
setw -g mode-keys vi
# Use zsh inside tmux panes
tmux set-option default-command "/usr/bin/env zsh"
# Make @ do the opposite of !
bind-key @ list-windows; command-prompt -p "create pane from:" "join-pane -s ':%%'"

TMUX cheat sheet

Standard Bindings

Binding Mode Action

Ctrl+b, :

default

Enter command mode/prompt

Ctrl+b, Ctrl+[

default

Enter copy mode

Ctrl+b, Ctrl+]

default

Paste buffer

Ctrl+b, #

default

List all paste buffers

Ctrl+b, $

default

Rename the current session

Ctrl+b, !

default

Break the current pane out of the window

Ctrl+b, "

default

Split the current pane into two, top and bottom

Ctrl+b, %

default

Split the current pane into two, left and right

Ctrl+b, &

default

Kill the current window

Modified Bindings

Binding Mode Action

bind-key @ list-windows; command-prompt -p "create pane from:" "join-pane -s ':%%'"

Ctrl+b, @

default

Create new pane from existing window

Misc

SSH agent forwarding inside a re-attached tmux session

# Before launching tmux
sed -i '/SSH_AUTH_SOCK/d' ~/vars.txt
echo -n 'export ' >> ~/vars.txt
env | awk '/SSH_AUTH_SOCK/{print; exit}' >> ~/vars.txt

# Launch tmux
tmux attach || tmux

# Retreive vars inside tmux
source ~/vars.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment