tmux Cheatsheet

[MOD = Ctrl-b]

Session

Keys Semantic
Mod-$ Rename session
Mod-$ detach from session
Mod-( Move to previous session
Mod-) Move to next session

Windows

Keys Semantic
Mod-c create a new window
Mod-w list all existing windows
Mod-& close the current window
Mod-, rename the current window
Mod-l toggle last active window
Mod-n focus next window
Mod-p focus previous window
Mod-# focus the specified window, where # is a number between 0 and 9
Mod-d detach from the current session
tmux attach reattach to a session

Panes

Keys Semantic
Mod-% split the current window into two horizontally
Mod-“ split the current window into two vertically
Mod-o toggle between panes
Mod-x kill the current pane
Mod-[ scroll
Mod-h move to the left pane. *
Mod-j move to the pane below *
Mod-l move to the right pane *
Mod-k move to the pane above *

Misc

Keys Semantic
Mod-: Enter Command Mode
:set -g OPTION Set OPTION for all sessions
:setw -g OPTION Set OPTION for all windows
:set mouse on Enables mouse mode
:new Start a new session
:new -s mysession Start a new session with the name mysession

Source: tmuxcheatsheet

tmux.conf

My currently used configuration for .tmux.conf

# Set prefix to Ctrl-Space
unbind C-b
set -g prefix C-Space
bind Space send-prefix

# Enable mouse mode (tmux 2.1 and above)
set -g mouse on

# to enable mouse scroll, see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"

# Start window numbers from 1
set -g base-index 1

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
Written on July 19, 2022


◀ Back to the Pensieve