Panes: splitting the screen

tmux · Essentials · 10 min

Panes put an editor, a test runner and a log tail on one screen, all driven from the keyboard.

A window can be split into panes, each running its own shell.

  • C-b % splits left/right, C-b " splits top/bottom.
  • C-b + arrow key moves to the pane in that direction; C-b o cycles through panes; C-b ; goes to the previously active pane.
  • C-b z zooms the current pane to fill the window and back again. A Z appears in the status bar while zoomed.
  • C-b x kills the current pane, C-b q briefly shows pane numbers (press a number to jump).
  • C-b Space cycles through the preset layouts (even-horizontal, even-vertical, main-horizontal, main-vertical, tiled).
  • C-b { and C-b } swap the current pane with the previous or next one.
  • C-b ! breaks the pane out into its own window; join-pane does the opposite.

Resize with C-b + Ctrl-arrow (one cell at a time, repeatable) or C-b + Alt-arrow (five cells), or drag borders with the mouse once mouse support is on.

The defaults are famously unmemorable, and new panes start in the directory tmux was started in rather than the current one; the configuration lesson rebinds both. Zoom is the most underrated key: work in a split layout, zoom to focus, unzoom to see everything.

Example

# inside tmux:
#   C-b %          split left/right
#   C-b "          split top/bottom
#   C-b <arrow>    move between panes
#   C-b z          zoom / unzoom the current pane
#   C-b Space      cycle layouts
#   C-b !          move this pane into its own window
tmux split-window -h -c "$PWD"          # left/right split, same directory
tmux select-layout main-vertical        # big pane left, others stacked right

Remember

  • % splits left/right, " splits top/bottom
  • C-b z zooms a pane; C-b Space cycles layouts
  • Every pane is an independent shell

Watch out for

  • Closing a pane with C-b x when you only wanted to hide it; zoom (C-b z) instead.

Check yourself

  1. You have four panes and want one of them to fill the whole window temporarily. What do you press?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: github.com/tmux/tmux/wiki/Getting-Started