Tmux Cheatsheet

Tmux Cheat Sheet Command and Quick Reference.

Stop juggling terminal tabs and start using tmux. This command integrates the terminal multiplexer into your daily routine, offering a seamless way to tile windows, script your environment, and maintain session persistence. It’s the essential tool for anyone looking to maximize their screen real estate and command-line mastery

Sessions

  • tmux — Start a new session
  • tmux new -s mysession — Start a new session with the name mysession
  • tmux ls — List all running sessions
  • tmux a — Attach to the last session
  • tmux a -t mysession — Attach to a specific session by name
  • Ctrl+b d — Detach from the current session
  • Ctrl+b s — Show all sessions (interactive list)
  • Ctrl+b \$ — Rename the current session
  • tmux kill-session -t mysession — Kill/delete a specific session
  • tmux kill-server — Kill the tmux server and all sessions

Windows (Tabs)

  • Ctrl+b c — Create a new window
  • Ctrl+b , — Rename the current window
  • Ctrl+b & — Close the current window (with confirmation)
  • Ctrl+b n — Go to the next window
  • Ctrl+b p — Go to the previous window
  • Ctrl+b 0-9 — Switch to window by number
  • Ctrl+b w — List all windows in the current session
  • Ctrl+b f — Find a window by name

Panes (Splits)

  • Ctrl+b % — Split the current pane vertically (left/right)
  • Ctrl+b " — Split the current pane horizontally (top/bottom)
  • Ctrl+b o — Cycle through panes
  • Ctrl+b q — Show pane numbers (type the number to jump to that pane)
  • Ctrl+b x — Kill the current pane
  • Ctrl+b z — Toggle pane zoom (maximize/restore)
  • Ctrl+b ! — Convert the current pane into a new window
  • Ctrl+b \{ or \} — Swap the current pane with the previous or next one
  • Ctrl+b Space — Toggle between different pane layouts

Resizing Panes

  • Ctrl+b : — Enter command mode, then type:
    • resize-pane -D — Resize down
    • resize-pane -U — Resize up
    • resize-pane -L — Resize left
    • resize-pane -R — Resize right
    • resize-pane -D 10 — Resize down by 10 cells
  • Ctrl+b + Arrow Keys (hold Ctrl) — Resize pane incrementally

Copy Mode (Vi Mode)

To enable vi keys, add setw -g mode-keys vi to your .tmux.conf.

  • Ctrl+b \[ — Enter copy mode
  • q — Exit copy mode
  • g — Go to the top
  • G — Go to the bottom
  • Space — Begin selection
  • Enter — Copy selection
  • Ctrl+b \] — Paste the most recently copied buffer
  • / — Search forward
  • ? — Search backward
  • n — Next search match

Miscellaneous

  • Ctrl+b t — Show a large digital clock
  • Ctrl+b ? — List all key bindings
  • Ctrl+b : — Enter the tmux command prompt
  • :setw synchronize-panes — Toggle “Sync Panes” (send input to all panes in the window)