How to effectively manage panes in tmux?

Quick Answer

Manage panes in tmux using: Ctrl+b % (split vertical), Ctrl+b " (split horizontal), Ctrl+b arrow (navigate), Ctrl+b z (zoom), Ctrl+b x (close).

Ctrl+b % (vertical split)
Ctrl+b " (horizontal split)

Detailed Explanation

Panes are subdivisions within a tmux window that allow you to run multiple terminal sessions side by side in the same window. Efficient pane management is key to a productive tmux workflow.

Creating panes:

Ctrl+b %Split pane vertically (side by side)
Ctrl+b "Split pane horizontally (top and bottom)

Navigating between panes:

Ctrl+b arrow keyMove to pane in direction of arrow key
Ctrl+b oCycle through panes in order
Ctrl+b qShow pane numbers (press number to select)
Ctrl+b ;Toggle between current and last pane

Resizing panes:

Ctrl+b Ctrl+arrow keyResize pane in direction of arrow key (repeat for larger adjustment)
Ctrl+b Alt+arrow keyResize pane in direction of arrow key (5-cell increments)
Ctrl+b :Enter command mode, then use:resize-pane -D 10 (resize down 10 cells)resize-pane -U 10 (resize up 10 cells)resize-pane -L 10 (resize left 10 cells)resize-pane -R 10 (resize right 10 cells)

Managing panes:

Ctrl+b zZoom/unzoom current pane to full window
Ctrl+b !Convert pane into a new window
Ctrl+b xClose current pane (will prompt)
Ctrl+b {Move current pane left
Ctrl+b }Move current pane right
Ctrl+b SpaceCycle through pane layouts

Preset layouts:

tmux offers several preset layouts that can be cycled through with Ctrl+b Space or set directly:

Ctrl+b :select-layout even-horizontal
Ctrl+b :select-layout even-vertical
Ctrl+b :select-layout main-horizontal
Ctrl+b :select-layout main-vertical
Ctrl+b :select-layout tiled

Pro Tip

For a custom split, you can specify an exact percentage:

Ctrl+b :split-window -v -p 30  # Horizontal split, new pane is 30% of height
Ctrl+b :split-window -h -p 40  # Vertical split, new pane is 40% of width

Pane Synchronization

To send the same commands to all panes in a window simultaneously:

Ctrl+b :setw synchronize-panes on

To turn it off:

Ctrl+b :setw synchronize-panes off