Skip to main content
tmux

Panes

Step 4 of 8

Panes

Panes are where tmux becomes powerful. A pane is a split section of a window — multiple shell sessions visible at once.

This is perfect for:

  • Side-by-side code comparison
  • Watching logs while editing code
  • Running tests while developing
  • SSH into multiple servers simultaneously
NOTE:

Panes are independent. Each has its own shell, working directory, and running programs.

Splitting vertically

Split the current pane horizontally (top/bottom):

$

The % key is Shift-5 on most keyboards. The window splits into two panes stacked vertically.

Splitting horizontally

Split the current pane vertically (left/right):

$

The " key is Shift-'. The window splits into two panes side by side.

NOTE:

" requires Shift. A common mistake is pressing just the quote key.

Navigating between panes

Move to the next pane:

$

This cycles through all panes in the current window.

Jump to a specific pane using arrow keys:

$
$
$
$
NOTE:

Arrow key navigation requires tmux 2.1+ (most modern systems). Older versions use Ctrl-b q then numbers.

Quick pane selection

Show pane numbers:

$

Each pane displays a number briefly. Press the number to jump to that pane.

This is faster than arrow keys when you have many panes.

Resizing panes

Resize the current pane:

$
$
$
$

Hold Ctrl-b and Ctrl together, then press arrow keys.

NOTE:

For finer control, use Ctrl-b : and type: resize-pane -U 5 (up 5 lines), -D 5 (down), -L 5 (left), -R 5 (right).

Zooming panes

Temporarily maximize a pane:

$

The pane expands to fill the window. Press again to restore the original layout.

NOTE:

Use zoom for temporary fullscreen editing. vim in one pane, zoom to focus, then zoom out to see other panes.

Closing panes

Close the current pane:

$

Or kill it:

$

Confirm with y.

NOTE:

Closing the last pane in a window closes the window. Be careful not to lose work!

Pane layouts

tmux has predefined layouts that rearrange panes evenly:

$

Cycle through layouts:

  • even-horizontal: Panes stacked vertically (same width)
  • even-vertical: Panes side by side (same height)
  • main-horizontal: One large pane on top, others below
  • main-vertical: One large pane on left, others on right
  • tiled: All panes same size, arranged in grid
NOTE:

main-vertical is perfect for: main pane (vim/editor), side panes (tests, logs).

Practical layouts

Code + tests:

┌─────────────┬─────────────┐
│  vim main   │  vim test   │
└─────────────┴─────────────┘

Create: Ctrl-b % (vertical split)

Editor + logs:

┌─────────────┐
│    vim      │
├─────────────┤
│  tail -f    │
└─────────────┘

Create: Ctrl-b " (horizontal split)

Main + side panes:

┌─────────┬───┬───┐
│         │   │   │
│   vim   │ t │ l │
│         │ e │ o │
│         │ s │ g │
│         │ t │ s │
└─────────┴───┴───┘

Create: Ctrl-b " then Ctrl-b % twice, use main-vertical layout

Breaking panes into windows

Move a pane to its own window:

$

The pane becomes a new window.

Joining panes

Move a pane from another window into the current one:

$

Then type: join-pane -s sessionname:windowname.pane

NOTE:

Pane joining syntax is verbose. Most users just close and recreate panes.

Synchronizing panes

Type into all panes simultaneously:

$

Then type: set-window-option synchronize-panes

This is useful for running the same command on multiple servers.

NOTE:

Create a key binding for this in your .tmux.conf: bind * set-window-option synchronize-panes

Key bindings summary

KeyAction
Ctrl-b %Split vertically (left/right)
Ctrl-b "Split horizontally (top/bottom)
Ctrl-b oCycle to next pane
Ctrl-b ↑↓←→Navigate with arrow keys
Ctrl-b qShow pane numbers
Ctrl-b Ctrl-↑↓←→Resize pane
Ctrl-b zZoom/unzoom pane
Ctrl-b SpaceCycle layouts
Ctrl-b !Break pane to window
Ctrl-b xKill pane

Command-line usage

# Split current window
tmux split-window -v    # vertical split (top/bottom)
tmux split-window -h    # horizontal split (left/right)

# Select pane by index
tmux select-pane -t 0

# Resize pane
tmux resize-pane -U 5   # up 5 lines
tmux resize-pane -D 10  # down 10 lines

# Send keys to pane
tmux send-keys -t sessionname:windowname.pane "ls -la" Enter

Common workflows

Watching logs while coding:

  1. Split: Ctrl-b "
  2. Bottom pane: tail -f logs/app.log
  3. Top pane: edit code
  4. Changes appear in logs as you work

Side-by-side comparison:

  1. Split: Ctrl-b %
  2. Left pane: vim file1.ts
  3. Right pane: vim file2.ts
  4. Compare implementations

Testing workflow:

  1. Main pane: vim editor
  2. Side pane: npm test --watch
  3. See test results while editing
NOTE:

Panes + zoom (Ctrl-b z) give you focus when you need it, then context when you don't.


Next: Step 5 → Key Bindings — Mastering the prefix key and command mode