⌨️
💻
🖥️
Ctrl
+
b
← Default Prefix (Press these keys first)
tmux new -s [name]
Create new session with name
tmux ls
List all sessions
tmux a -t [name]
Attach to session
Ctrl+b d
Detach from session
Ctrl+b $
Rename session
tmux kill-ses -t [name]
Kill session by name
Ctrl+b s
Show all sessions
Ctrl+b ( )
Previous / Next session
-A
Attach or create new session if it doesn't exist
-d
Detach other clients from session
Ctrl+b c
Create new window
Ctrl+b ,
Rename current window
Ctrl+b n
Next window
Ctrl+b p
Previous window
Ctrl+b 0-9
Switch to window by number
Ctrl+b w
List windows interactively
Ctrl+b &
Close current window
Ctrl+b l
Toggle last active window
Move Window:
:move-window -t [target_session]:[position]
Ctrl+b %
Split pane vertically (|)
Ctrl+b "
Split pane horizontally (-)
Ctrl+b ←↑↓→
Navigate to pane in direction
Ctrl+b o
Switch to next pane
Ctrl+b q
Show pane numbers
Ctrl+b z
Toggle pane zoom (fullscreen)
Ctrl+b x
Close current pane
Ctrl+b { }
Move pane left / right
Ctrl+b !
Convert pane to window
Ctrl+b Space
Toggle between layouts
Resize Pane:
Ctrl+b Alt+←↑↓→
Resize pane in direction
Ctrl+b :resize-pane -[DULR]
Resize by specific amount
-h / -v
Split window horizontally / vertically
-c [path]
Set working directory for new pane/window
-t [target]
Specify target session/window/pane
-s [source]
Specify source for operations
-n [name]
Set name for new window/session
-r
Renumber windows (remove gaps)
-E
Spread panes evenly in layout
Join Panes:
:join-pane -s 2 -t 1 # Join window 2 to window 1
Ctrl+b [ → Enter Copy Mode | q → Quit
h j k l
Move cursor (vim-style)
w / b
Forward / backward one word
0 / $
Start / end of line
g / G
Top / bottom of buffer
Ctrl+d / Ctrl+u
Half page down / up
/ / ?
Search forward / backward
n / N
Next / previous search result
Space
Start selection
Enter / y
Copy selection
Ctrl+b ]
Paste from buffer
Enable Vi Mode in Config:
setw -g mode-keys vi
keyboard
Change Prefix Key to Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
mouse
Enable Mouse Support
set -g mouse on # Click panes, resize, scroll
settings
Essential Settings
set -g base-index 1 # Windows start at 1
setw -g pane-base-index 1 # Panes start at 1
set -g renumber-windows on # Auto-renumber windows
set -g history-limit 50000 # Increase history
set -g display-time 2000 # Longer status messages
set-option -g allow-rename off # Prevent auto-rename
speed
Intuitive Pane Splits
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
refresh
Quick Config Reload
bind r source-file ~/.tmux.conf \; display "Config Reloaded!"
view_quilt
Built-in Pane Layouts
Press Ctrl+b Space to cycle through layouts:
navigation
Vim-Style Pane Navigation
# Navigate panes with h,j,k,l
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
# Resize panes with H,J,K,L
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
sync
Sync Panes (Type in All Panes)
:setw synchronize-panes on # Enable sync
:setw synchronize-panes off # Disable sync
💡 Great for running same command across multiple servers
save
Save & Restore Custom Layouts
# Save current layout
:select-layout -E # Spread evenly first
:run-shell "tmux list-windows -F '#{window_layout}' > ~/.tmux-layout"
# Restore saved layout
:run-shell "tmux select-layout \"$(cat ~/.tmux-layout)\""
dashboard
Custom Layout Shortcuts
# Add to ~/.tmux.conf
bind-key H select-layout even-horizontal
bind-key V select-layout even-vertical
bind-key P select-layout main-vertical \; resize-pane -t 0 -x 120
Ctrl+b H Horizontal layout
Ctrl+b V Vertical layout
Ctrl+b P Programming layout
keyboard_arrow_right
Alt-Arrow Pane Navigation (No Prefix)
# 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
content_copy
System Clipboard Integration (Linux)
# Copy to system clipboard: Alt+c
bind M-c run "tmux save-buffer - | xclip -i -sel clipboard"
# Paste from system clipboard: Alt+v
bind M-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
tune
Status Bar Customization
set -g status-position bottom
set -g status-justify left
set -g status-style 'fg=cyan bg=black'
set -g status-left ''
set -g status-right '%Y-%m-%d %H:%M '
set -g status-right-length 50
setw -g window-status-current-style 'fg=black bg=cyan'
restore
Session Persistence with tmux-resurrect
Install tmux-resurrect plugin to save and restore sessions:
# Save: Ctrl+b Ctrl+s
# Restore: Ctrl+b Ctrl+r
# Install via TPM (Tmux Plugin Manager)
set -g @plugin 'tmux-plugins/tmux-resurrect'