tmux Quick Reference

Sessions

# Create a new named session
tmux new -s <name>

# Create detached (runs in background)
tmux new -d -s <name>

# Create with a command
tmux new -d -s <name> "command here"

# List sessions
tmux ls

# Attach to a session
tmux attach -t <name>

# Kill a session
tmux kill-session -t <name>

Inside tmux

  • Ctrl+b d — detach from session

Windows

  • Ctrl+b c — new window
  • Ctrl+b n — next window
  • Ctrl+b p — previous window
  • Ctrl+b [0-9] — jump to window by number
  • Ctrl+b w — window list with live preview (arrow keys to browse, Enter to switch)
  • Ctrl+b & — kill current window
# New window with a name
tmux new-window -n "my-window"

# New window running a command
tmux new-window "npm run dev"

# Kill window by name or number
tmux kill-window -t <name-or-number>

Tip: In the window list (Ctrl+b w), press x to kill the highlighted window.

Panes (splits)

  • Ctrl+b % — split vertical (left/right)
  • Ctrl+b " — split horizontal (top/bottom)
  • Ctrl+b arrow — navigate between panes
  • Ctrl+b z — zoom pane (fullscreen toggle)
  • Ctrl+b x — kill current pane
  • Ctrl+b { — swap pane with previous
  • Ctrl+b } — swap pane with next

Moving windows into panes

# Pull window 2 into current window as a pane (Ctrl+b : to enter command mode)
join-pane -s :2

# Control split direction: -h = side by side, -v = stacked
join-pane -h -s :2      # window 2 joins on the right
join-pane -v -s :2      # window 2 joins below

# Pull from another session
join-pane -s other-session:1

# Send current pane back out to its own window
break-pane

Dev Server Example

# Start runtime dev server in a named session
tmux new -d -s pathmx "cd /Users/wmdmark/sources/pathmx && bun run --filter runtime dev"

# Attach to it
tmux attach -t pathmx

Multiple Packages

tmux new-session -d -s pathmx -c /Users/wmdmark/sources/pathmx
tmux send-keys -t pathmx "bun run --filter runtime dev" Enter
tmux split-window -h -t pathmx
tmux send-keys -t pathmx "bun run --filter server dev" Enter
tmux attach -t pathmx