← All field notes
CTO notes 2 min read

Tmux Cheat Sheet

Starting & Managing Sessions Window Management Pane Management Copy & Paste Mode Customization (via ~/.tmux.conf) Add these lines to your ~/.tmux.conf to customize your experience: This cheat sheet covers the […]

Starting & Managing Sessions

  • Start a New Session: tmux
  • Start a Named Session: tmux new -s session_name
  • Detach from a Session:
    Press: Ctrl + b, then d
  • List All Sessions: tmux ls
  • Attach to a Session: tmux attach -t session_name
  • Kill a Session: tmux kill-session -t session_name
  • Kill All Sessions (tmux server): tmux kill-server

Window Management

  • Create a New Window:
    Press: Ctrl + b, then c
  • Switch to Next Window:
    Press: Ctrl + b, then n
  • Switch to Previous Window:
    Press: Ctrl + b, then p
  • List Windows:
    Press: Ctrl + b, then w
  • Rename Current Window:
    Press: Ctrl + b, then , (then type new name)

Pane Management

  • Split Window Vertically:
    Press: Ctrl + b, then
  • Split Window Horizontally:
    Press: Ctrl + b, then %
  • Switch Between Panes:
    Press: Ctrl + b, then o
    or use the arrow keys: Ctrl + b, then ←/→/↑/↓
  • Resize Panes:
    Enter command mode: Ctrl + b, then :
    Then type: resize-pane -L 10 # Resize left by 10 cells resize-pane -R 10 # Resize right by 10 cells resize-pane -U 5 # Resize up by 5 cells resize-pane -D 5 # Resize down by 5 cells
  • Close Current Pane:
    Type exit or press Ctrl + d

Copy & Paste Mode

  • Enter Copy Mode:
    Press: Ctrl + b, then [
  • Scroll Through History:
    Use arrow keys or Page Up/Down
  • Start Selection (in vi mode):
    Press Space to begin selection, then Enter to copy
  • Paste Copied Text:
    Press: Ctrl + b, then ]
  • View All Key Bindings:
    Press: Ctrl + b, then ?

Customization (via ~/.tmux.conf)

Add these lines to your ~/.tmux.conf to customize your experience:

# Change the prefix key from Ctrl+b to Ctrl+a
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# Enable mouse mode for pane selection and window resizing
set -g mouse on

# Use vi keys in copy mode
setw -g mode-keys vi
  • Reload Configuration Without Restarting Tmux: tmux source-file ~/.tmux.conf

This cheat sheet covers the basics and should serve as a quick reference to improve your workflow when using Tmux. Enjoy your enhanced terminal productivity!

AS

Written by Alan Son

CTO judgment, grounded in delivery.

I build commercial AI products and help founders turn ambitious technical ideas into reliable production systems.

More about my work

Need an experienced technical partner?

Let’s work out the right next move.