tmux Split Window & Pane Management Guide
Master tmux split windows and pane management. Learn horizontal and vertical splits, pane navigation, resizing, layouts, zoom, synchronized input, and practical workflows.
Dai Aoki
CEO at init, Inc. / CTO at US & JP startups / Creator of WebTerm
Understanding tmux Splits
One of the most confusing aspects of tmux for newcomers is its split terminology. The naming convention is counterintuitive because tmux names splits based on the direction of the divider line, not the direction the panes are arranged.
The Confusing Terminology
split-window -h(orprefix + %) creates a horizontal divider — panes are placed side by side (left/right). The divider runs vertically, but tmux calls this a "horizontal" split because the pane is split along the horizontal axis.split-window -v(orprefix + ") creates a vertical divider — panes are stacked (top/bottom). The divider runs horizontally, but tmux calls this a "vertical" split because the pane is split along the vertical axis.
Think of it this way: -h splits the pane horizontally (cutting it with a vertical line), and -v splits the pane vertically (cutting it with a horizontal line). Here is a visual diagram:
# split-window -h (prefix + %)
# "Horizontal split" = panes side by side
# The divider line is vertical: |
+---------------+---------------+
| | |
| | |
| Pane 0 | Pane 1 |
| | |
| | |
+---------------+---------------+
# split-window -v (prefix + ")
# "Vertical split" = panes stacked
# The divider line is horizontal: ---
+-------------------------------+
| |
| Pane 0 |
| |
+-------------------------------+
| |
| Pane 1 |
| |
+-------------------------------+| Command | Key Binding | Divider | Pane Arrangement |
|---|---|---|---|
| split-window -h | prefix + % | Vertical line | | Side by side (left/right) |
| split-window -v | prefix + " | Horizontal line --- | Stacked (top/bottom) |
Creating Splits
There are two main ways to create splits in tmux: using command-line commands or key bindings. Both approaches offer the same functionality, but command-line commands provide more precise control over pane size and target.
Command Line Splits
You can create splits from the terminal or from the tmux command prompt (prefix + :):
# Vertical split (panes stacked top/bottom)
tmux split-window -v
# Horizontal split (panes side by side)
tmux split-window -h
# Split with a specific percentage size
# Create a horizontal split where the new pane takes 30% of the width
tmux split-window -h -p 30
# Create a vertical split where the new pane takes 20% of the height
tmux split-window -v -p 20
# Split with an exact size in lines or columns
# New pane will be exactly 80 columns wide
tmux split-window -h -l 80
# New pane will be exactly 10 lines tall
tmux split-window -v -l 10
# Split and run a specific command in the new pane
tmux split-window -v 'tail -f /var/log/syslog'
# Split and run htop in the new pane
tmux split-window -h 'htop'
# Split a specific window (target window 2)
tmux split-window -t :2 -vKey Binding Splits
The default key bindings for splitting are:
| Key Binding | Action | Result |
|---|---|---|
| prefix + % | Horizontal split | Panes side by side (left/right) |
| prefix + " | Vertical split | Panes stacked (top/bottom) |
| prefix + x | Close current pane | Kills the active pane (with confirmation) |
The default prefix key is Ctrl + b. So to create a horizontal split, you would press Ctrl + b, release, then press %.
Pane Navigation
Once you have multiple panes open, navigating between them efficiently is essential. tmux offers several methods for moving between panes.
Arrow Key Navigation
The simplest way to navigate between panes is with arrow keys:
# Move to the pane in the given direction
prefix + Up # Move to pane above
prefix + Down # Move to pane below
prefix + Left # Move to pane on the left
prefix + Right # Move to pane on the rightVim-Style Navigation
Many users prefer vim-style navigation with h/j/k/l keys. This requires adding bindings to your ~/.tmux.conf:
# Add to ~/.tmux.conf for vim-style pane navigation
bind h select-pane -L # Move left
bind j select-pane -D # Move down
bind k select-pane -U # Move up
bind l select-pane -R # Move rightAfter adding these bindings and reloading the config (prefix + : then source-file ~/.tmux.conf), you can use prefix + h/j/k/l to navigate panes.
Other Navigation Methods
| Key Binding | Action |
|---|---|
| prefix + o | Cycle to the next pane |
| prefix + ; | Toggle to the last active pane |
| prefix + q | Display pane numbers, then press the number to jump to that pane |
| prefix + { / prefix + } | Swap the current pane with the previous / next pane |
You can also enable mouse mode for click-to-focus navigation:
# Enable mouse mode (add to ~/.tmux.conf)
set -g mouse on
# With mouse mode enabled, you can:
# - Click on any pane to focus it
# - Drag pane borders to resize
# - Scroll with the mouse wheel
# - Select text (hold Shift to bypass tmux and use terminal selection)Resizing Panes
tmux provides multiple methods for resizing panes, from key bindings for quick adjustments to command-line options for precise control.
| Key Binding | Action | Resize Amount |
|---|---|---|
| prefix + Ctrl + Up | Resize pane upward | 1 cell |
| prefix + Ctrl + Down | Resize pane downward | 1 cell |
| prefix + Ctrl + Left | Resize pane left | 1 cell |
| prefix + Ctrl + Right | Resize pane right | 1 cell |
| prefix + Alt + Up | Resize pane upward | 5 cells |
| prefix + Alt + Down | Resize pane downward | 5 cells |
| prefix + Alt + Left | Resize pane left | 5 cells |
| prefix + Alt + Right | Resize pane right | 5 cells |
# Resize pane using command line (from tmux command prompt or shell)
# Resize down by 10 cells
tmux resize-pane -D 10
# Resize up by 10 cells
tmux resize-pane -U 10
# Resize left by 10 cells
tmux resize-pane -L 10
# Resize right by 10 cells
tmux resize-pane -R 10
# Set exact width (in columns)
tmux resize-pane -x 80
# Set exact height (in rows)
tmux resize-pane -y 24
# Set both width and height at once
tmux resize-pane -x 80 -y 24
# Resize a specific pane (target pane 1 in current window)
tmux resize-pane -t 1 -R 20Pane Layouts
tmux includes five built-in layouts that automatically arrange panes within a window. You can cycle through them or select a specific layout.
# 1. even-horizontal: All panes arranged in equal-width columns
+--------+--------+--------+
| | | |
| | | |
| Pane 0 | Pane 1 | Pane 2 |
| | | |
| | | |
+--------+--------+--------+
# 2. even-vertical: All panes arranged in equal-height rows
+------------------------+
| Pane 0 |
+------------------------+
| Pane 1 |
+------------------------+
| Pane 2 |
+------------------------+
# 3. main-horizontal: One large pane on top, others below
+------------------------+
| |
| Main Pane |
| |
+--------+-------+-------+
| Pane 1 |Pane 2 |Pane 3 |
+--------+-------+-------+
# 4. main-vertical: One large pane on left, others stacked right
+------------+-----------+
| | Pane 1 |
| +-----------+
| Main Pane | Pane 2 |
| +-----------+
| | Pane 3 |
+------------+-----------+
# 5. tiled: All panes arranged in a roughly equal grid
+------------+-----------+
| | |
| Pane 0 | Pane 1 |
| | |
+------------+-----------+
| | |
| Pane 2 | Pane 3 |
| | |
+------------+-----------+| Key Binding / Command | Action |
|---|---|
| prefix + Space | Cycle through the five built-in layouts |
| prefix + Alt + 1 | Switch to even-horizontal layout |
| prefix + Alt + 2 | Switch to even-vertical layout |
| prefix + Alt + 3 | Switch to main-horizontal layout |
| prefix + Alt + 4 | Switch to main-vertical layout |
| prefix + Alt + 5 | Switch to tiled layout |
# Select a specific layout by name
tmux select-layout even-horizontal
tmux select-layout even-vertical
tmux select-layout main-horizontal
tmux select-layout main-vertical
tmux select-layout tiled
# Set the main pane size for main-horizontal and main-vertical layouts
# Main pane height (for main-horizontal)
tmux set-window-option main-pane-height 60%
# Main pane width (for main-vertical)
tmux set-window-option main-pane-width 60%Zoom and Break
tmux provides powerful features for temporarily maximizing a pane, breaking it out into its own window, or merging panes from different windows.
| Key Binding | Action | Description |
|---|---|---|
| prefix + z | Toggle zoom | Temporarily maximize the current pane to fill the entire window. Press again to restore the original layout. |
| prefix + ! | Break pane | Move the current pane into a new window of its own. |
# Toggle zoom on the current pane (also available via prefix + z)
tmux resize-pane -Z
# Break the current pane into a new window
tmux break-pane
# Break a specific pane into a new window
tmux break-pane -t 2
# Join a pane from another window into the current window
# Move pane from window 2 to the current window (vertical split)
tmux join-pane -s :2
# Move pane from window 2 to window 1 (horizontal split)
tmux join-pane -h -s :2 -t :1
# Move a specific pane (pane 1 from window 3) to the current window
tmux join-pane -s :3.1
# Swap two panes
tmux swap-pane -s 0 -t 1Zoom is particularly useful when you need to temporarily focus on one pane to view output or edit a file, then return to your multi-pane layout. A zoomed pane shows a Z flag in the status bar.
Synchronized Input
Synchronized panes allow you to type the same input into all panes within a window simultaneously. This is incredibly useful when you need to run the same command across multiple servers or environments.
# Enable synchronized input for all panes in the current window
tmux setw synchronize-panes on
# Disable synchronized input
tmux setw synchronize-panes off
# Toggle synchronized input (useful as a key binding)
tmux setw synchronize-panes
# You can also use the tmux command prompt:
# prefix + : then type:
# setw synchronize-panes on
# setw synchronize-panes offUse Cases for Synchronized Input
- Multi-server management: SSH into multiple servers in separate panes, enable sync, and run the same commands on all servers at once (e.g., updating packages, checking disk space).
- Comparing environments: Open panes connected to staging and production, then run the same diagnostic commands to compare outputs side by side.
- Batch operations: Perform the same file operations across multiple directories or projects simultaneously.
# Practical example: Update packages on 3 servers simultaneously
# 1. Create panes and SSH into each server
tmux new-session -s servers
tmux split-window -v
tmux split-window -v
tmux select-layout even-vertical
# In each pane, SSH to a different server:
# Pane 0: ssh user@server1
# Pane 1: ssh user@server2
# Pane 2: ssh user@server3
# 2. Enable synchronized input
tmux setw synchronize-panes on
# 3. Now any command you type goes to ALL panes:
# sudo apt update && sudo apt upgrade -y
# df -h
# free -m
# 4. Disable sync when done
tmux setw synchronize-panes offA useful key binding to quickly toggle synchronized input:
# Add to ~/.tmux.conf - toggle sync with prefix + S
bind S setw synchronize-panesPractical Workflows
Combining splits, layouts, and navigation creates powerful workflows for everyday tasks. Below are common setups that you can adapt to your needs.
Development Environment
A typical development layout with an editor, terminal, and log viewer:
# Development layout:
# +----------------------------+----------+
# | | |
# | | Logs |
# | Editor | tail -f |
# | (vim/nvim) | |
# | +----------+
# | | |
# | | Terminal |
# | | (shell) |
# +----------------------------+----------+# Create the development layout
tmux new-session -s dev -d
# Create the right pane (logs) - 35% width
tmux split-window -h -p 35
# Split the right pane vertically for terminal
tmux split-window -v -p 50
# Select the left pane (editor) and open your editor
tmux select-pane -t 0
tmux send-keys 'nvim .' Enter
# Select the top-right pane (logs) and tail logs
tmux select-pane -t 1
tmux send-keys 'tail -f logs/development.log' Enter
# Attach to the session
tmux attach -t devMonitoring Setup
A monitoring dashboard with system metrics, logs, and disk usage:
# Monitoring layout:
# +----------------------------+----------+
# | | |
# | htop | Disk |
# | (system monitor) | Usage |
# | | (watch) |
# +----------------------------+----------+
# | | |
# | Log Viewer | Network |
# | (tail -f syslog) | (iftop) |
# | | |
# +----------------------------+----------+# Create the monitoring layout
tmux new-session -s monitor -d
# Split into top and bottom
tmux split-window -v -p 50
# Split top row: left (htop) and right (disk)
tmux select-pane -t 0
tmux split-window -h -p 30
# Split bottom row: left (logs) and right (network)
tmux select-pane -t 2
tmux split-window -h -p 30
# Start commands in each pane
tmux select-pane -t 0
tmux send-keys 'htop' Enter
tmux select-pane -t 1
tmux send-keys 'watch -n 5 df -h' Enter
tmux select-pane -t 2
tmux send-keys 'tail -f /var/log/syslog' Enter
tmux select-pane -t 3
tmux send-keys 'sudo iftop' Enter
# Attach to the session
tmux attach -t monitorRecommended tmux.conf Bindings
The default split key bindings (% and ") are not intuitive. Many users remap them to | and - which visually represent the direction of the split.
# ~/.tmux.conf - Recommended pane management bindings
# ── Intuitive split bindings ──
# | for vertical divider (side by side)
bind | split-window -h -c "#{pane_current_path}"
bind \ split-window -h -c "#{pane_current_path}"
# - for horizontal divider (stacked)
bind - split-window -v -c "#{pane_current_path}"
bind _ split-window -v -c "#{pane_current_path}"
# ── Vim-style pane navigation ──
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# ── Pane resizing with Shift + arrow ──
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# ── Quick pane management ──
bind S setw synchronize-panes # Toggle sync input
bind m resize-pane -Z # Toggle zoom (alternative to z)
# ── Open splits in current directory ──
# (already included in bindings above with -c flag)
# ── Mouse mode ──
set -g mouse on
# ── Start window/pane numbering at 1 ──
set -g base-index 1
setw -g pane-base-index 1
# ── Renumber windows when one is closed ──
set -g renumber-windows onQuick Reference
prefix + %- Split side by side (horizontal)prefix + "- Split stacked (vertical)prefix + arrow- Navigate between panesprefix + Ctrl + arrow- Resize pane (small step)prefix + Alt + arrow- Resize pane (large step)prefix + Space- Cycle through layoutsprefix + z- Toggle zoom on current paneprefix + !- Break pane into new windowprefix + o- Cycle to next paneprefix + x- Close current pane
Official Documentation
For authoritative information, refer to the official documentation:
Related Articles
tmux - Terminal Multiplexer
Terminal multiplexer for session management and window splitting
tmux Cheat Sheet: All Key Bindings & Commands
Complete tmux cheat sheet with all keyboard shortcuts, commands, and quick reference tables for sessions, windows, panes, and copy mode.
tmux Session Management: Complete Guide
Complete guide to tmux session management. Learn how to create, attach, detach, list, and organize sessions for efficient terminal workflows.
tmux.conf Configuration Guide: Customize Your tmux
Complete tmux.conf configuration guide. Learn prefix key customization, key bindings, status bar styling, mouse settings, true color, performance tuning, and workflow-specific configs.