Back

Tmux terminal window showing split panes and keyboard shortcuts

/ 6 min read

Tmux Cheat Sheet: Complete Keyboard Shortcut Guide

This is a complete reference guide for tmux based on my actual configuration. Everything you need to know about sessions, windows, panes, and navigation in one place.

Understanding the Prefix

Prefix Key: Ctrl+s

Almost every tmux command starts with the prefix. Press Ctrl+s, release, then press the next key.

Visual Indicator: When you press the prefix, the session name in the status bar turns red.

Session Management

Creating Sessions

Terminal window
# Create new session
tmux
# Create named session
tmux new -s myproject
# Create session with specific window name
tmux new -s myproject -n editor

Listing Sessions

Terminal window
# From terminal
tmux ls
# From inside tmux
Ctrl+s then s

Attaching to Sessions

Terminal window
# Attach to last session
tmux attach
# Attach to specific session
tmux attach -t myproject
# Attach to session (short form)
tmux a -t myproject

Detaching from Sessions

Terminal window
# Keyboard shortcut
Ctrl+s then d
# Detach all clients from session
tmux detach -a

Renaming Sessions

Terminal window
# From inside tmux
Ctrl+s then $
# From terminal
tmux rename-session -t oldname newname

Killing Sessions

Terminal window
# Kill specific session
tmux kill-session -t myproject
# Kill all sessions except current
tmux kill-session -a
# Kill all sessions
tmux kill-server

Switching Between Sessions

Terminal window
# Interactive session list
Ctrl+s then s
# Use arrow keys or j/k to navigate, Enter to select
# Switch to last session
Ctrl+s then L
# Switch to next session
Ctrl+s then (
# Switch to previous session
Ctrl+s then )

Window Management

Creating Windows

Terminal window
# Create new window
Ctrl+s then c

Switching Between Windows

Terminal window
# Next window (repeatable)
Ctrl+s then Ctrl+l
# Previous window (repeatable)
Ctrl+s then Ctrl+h
# Jump to window by number
Ctrl+s then 0-9
# Last used window
Ctrl+s then l
# Interactive window list
Ctrl+s then w
# Find window by name
Ctrl+s then f

Renaming Windows

Terminal window
Ctrl+s then ,

Killing Windows

Terminal window
# Kill current window (with confirmation)
Ctrl+s then &
# Kill window without confirmation
Ctrl+s then : then type "kill-window"

Moving Windows

Terminal window
# Move current window to position 5
Ctrl+s then : then type "move-window -t 5"
# Swap window with next
Ctrl+s then : then type "swap-window -t +1"
# Swap window with previous
Ctrl+s then : then type "swap-window -t -1"

Pane Management

Creating Panes

Terminal window
# Split horizontally (top/bottom)
Ctrl+s then "
# Split vertically (left/right)
Ctrl+s then %
Terminal window
# Vim-style navigation
Ctrl+s then h # Move left
Ctrl+s then j # Move down
Ctrl+s then k # Move up
Ctrl+s then l # Move right
# With vim-tmux-navigator plugin
Ctrl+h # Move left (no prefix needed)
Ctrl+j # Move down
Ctrl+k # Move up
Ctrl+l # Move right
# Cycle through panes
Ctrl+s then o
# Go to last active pane
Ctrl+s then ;
# Show pane numbers (then press number to jump)
Ctrl+s then q

Resizing Panes

Terminal window
# With mouse (enabled in config)
# Just drag the pane borders
# With keyboard
Ctrl+s then : then type "resize-pane -D 5" # Down 5 lines
Ctrl+s then : then type "resize-pane -U 5" # Up 5 lines
Ctrl+s then : then type "resize-pane -L 5" # Left 5 columns
Ctrl+s then : then type "resize-pane -R 5" # Right 5 columns

Zooming Panes

Terminal window
# Toggle zoom (fullscreen current pane)
Ctrl+s then z
# Status bar shows "zoom" indicator when active

Moving Panes

Terminal window
# Swap with next pane
Ctrl+s then }
# Swap with previous pane
Ctrl+s then {
# Rotate panes forward
Ctrl+s then Ctrl+o
# Move pane to new window
Ctrl+s then !
# Break pane into new window
Ctrl+s then : then type "break-pane"
# Join pane from another window
Ctrl+s then : then type "join-pane -s 2.1" # Join pane 1 from window 2

Pane Layouts

Terminal window
# Cycle through preset layouts
Ctrl+s then Space
# Available layouts:
# - even-horizontal
# - even-vertical
# - main-horizontal
# - main-vertical
# - tiled

Killing Panes

Terminal window
# Kill current pane (with confirmation)
Ctrl+s then x
# Kill pane without confirmation
exit # or Ctrl+d in the shell

Copy Mode (Scrollback)

Entering Copy Mode

Terminal window
# Custom keybinding
Alt+k
# Default keybinding
Ctrl+s then [
Terminal window
# Vim-style movement
h, j, k, l # Left, down, up, right
w, b # Next word, previous word
0, $ # Start of line, end of line
g, G # Top of buffer, bottom of buffer
Ctrl+u, Ctrl+d # Page up, page down
# Arrow keys also work
↑, ↓, ←,

Searching in Copy Mode

Terminal window
/ # Search forward
? # Search backward
n # Next match
N # Previous match

Copying Text

Terminal window
Space # Start selection
Enter # Copy selection and exit copy mode
Esc # Cancel selection
q # Exit copy mode

Pasting Text

Terminal window
Ctrl+s then ] # Paste most recent buffer
Ctrl+s then = # List all buffers and choose

Configuration Management

Reloading Config

Terminal window
# Custom keybinding
Ctrl+s then r
# Manual reload
Ctrl+s then : then type "source-file ~/.tmux.conf"

Viewing Current Settings

Terminal window
# Show all options
Ctrl+s then : then type "show-options -g"
# Show all key bindings
Ctrl+s then ?

Command Mode

Entering Command Mode

Terminal window
Ctrl+s then :

Useful Commands

Terminal window
:setw synchronize-panes on # Type in all panes simultaneously
:setw synchronize-panes off # Disable synchronized typing
:set mouse off # Disable mouse
:set mouse on # Enable mouse
:list-keys # Show all keybindings
:list-commands # Show all commands

Status Bar Information

My config shows:

Left Side:

  • Session name (red when prefix active, green otherwise)
  • Current command running
  • Current directory (shortened)
  • Zoom indicator

Center:

  • Window list with numbers
  • Current window highlighted in peach

Right Side:

  • Battery percentage (red if ≤10%)
  • Online/offline status
  • Date and time

Quick Reference Card

Sessions

ActionCommand
New sessiontmux new -s name
List sessionstmux ls or Ctrl+s s
Attachtmux a -t name
DetachCtrl+s d
RenameCtrl+s $
Killtmux kill-session -t name

Windows

ActionCommand
New windowCtrl+s c
Next windowCtrl+s Ctrl+l
Previous windowCtrl+s Ctrl+h
Jump to windowCtrl+s 0-9
Rename windowCtrl+s ,
Kill windowCtrl+s &
List windowsCtrl+s w

Panes

ActionCommand
Split horizontalCtrl+s "
Split verticalCtrl+s %
NavigateCtrl+s h/j/k/l
Zoom toggleCtrl+s z
Kill paneCtrl+s x
Swap panesCtrl+s { or }
Rotate panesCtrl+s Ctrl+o
Cycle layoutsCtrl+s Space

Copy Mode

ActionCommand
Enter copy modeAlt+k
Search forward/
Search backward?
Start selectionSpace
Copy selectionEnter
PasteCtrl+s ]
Exitq

System

ActionCommand
Reload configCtrl+s r
Command modeCtrl+s :
List keysCtrl+s ?
Show timeCtrl+s t

Common Workflows

Basic Development Setup

Terminal window
# 1. Create session
tmux new -s myproject
# 2. Split for editor and terminal
Ctrl+s then "
# 3. Navigate to bottom pane
Ctrl+s then j
# 4. Split for logs
Ctrl+s then %
# Result: Editor (top), terminal (bottom-left), logs (bottom-right)

Multiple Projects

Terminal window
# Create sessions for each project
tmux new -s frontend
Ctrl+s then d
tmux new -s backend
Ctrl+s then d
tmux new -s database
Ctrl+s then d
# Switch between them
Ctrl+s then s # Interactive list

Monitoring Multiple Services

Terminal window
# 1. Create session
tmux new -s monitoring
# 2. Create window for each service
Ctrl+s then c # Repeat for each service
# 3. Rename windows
Ctrl+s then , # Name: "nginx"
Ctrl+s then n # Next window
Ctrl+s then , # Name: "postgres"
# etc.
# 4. Switch between windows
Ctrl+s then Ctrl+h/l

Pair Programming

Terminal window
# Person 1: Create session
tmux new -s pairing
# Person 2: Attach to same session
tmux attach -t pairing
# Both see and control the same session

Tips

  • Mouse is enabled - Use it while learning, gradually switch to keyboard
  • Prefix indicator - Session name turns red when prefix is active
  • Zoom is your friend - Ctrl+s z to focus on one pane
  • Name everything - Named sessions and windows are easier to find
  • Detach freely - Sessions persist, you can always reattach
  • Copy mode - Alt+k to scroll and search history
  • Synchronized panes - Type in multiple panes at once with :setw synchronize-panes on

Plugins

Installed via TPM (Tmux Plugin Manager):

  • catppuccin/tmux - Mocha theme
  • vim-tmux-navigator - Seamless Vim/tmux navigation
  • tmux-battery - Battery status
  • tmux-online-status - Network status

TPM auto-installs on first run.