A tmux pane is just a window, and a window is just a file descriptor.

Let’s see how this works.

Here’s a running tmux session, showing two panes. Notice how they’re perfectly even, taking up exactly half the screen each.

+-----------------+-----------------+
|                 |                 |
|                 |                 |
|                 |                 |
|                 |                 |
|                 |                 |
|                 |                 |
+-----------------+-----------------+

This is achieved with a simple command:

tmux split-window -h -p 50

The -h flag tells tmux to split the window horizontally (creating side-by-side panes), and -p 50 means "make this new pane 50% of the available width." If you wanted to split vertically, you’d use -v.

To create an even grid of four panes, you’d do this:

tmux split-window -h -p 50
tmux split-window -v -p 50

The first command splits the current pane horizontally, creating two panes. The second command then splits the active pane vertically, resulting in four panes arranged in a 2x2 grid.

+-----------------+-----------------+
|                 |                 |
|                 |                 |
|-----------------+-----------------|
|                 |                 |
|                 |                 |
+-----------------+-----------------+

You can also use tmux select-layout to apply predefined layouts. For example, select-layout even-horizontal will arrange all panes in the current window into evenly spaced horizontal rows. even-vertical does the same but for vertical columns. tiled is another useful one, which attempts to arrange panes in a grid that fills the available space as evenly as possible.

The key to understanding tmux layouts is that it’s all about managing rectangular regions within the terminal window. When you split a pane, you’re essentially dividing an existing rectangle into two smaller ones. tmux keeps track of these regions and their sizes, allowing you to manipulate them with these layout commands.

The -p (percentage) option is powerful, but it refers to the original pane’s dimension. So, if you have a pane that’s 80 columns wide and you split it with -p 50, the new pane will be 40 columns wide, and the original pane will also resize to 40 columns. This is how the "even" distribution happens.

Many people think of tmux panes as independent entities, but it’s more accurate to think of them as partitions of a larger whole. When you issue a layout command, tmux recalculates the dimensions of all panes within that window to fit the desired layout.

The tiled layout is particularly interesting because it’s tmux’s best attempt at creating a visually balanced arrangement of panes, even when you have an odd number of panes or complex splitting histories. It prioritizes making the panes as square as possible while filling the entire window space.

You can also resize panes manually using Ctrl-b followed by Up, Down, Left, or Right arrow keys, or by using Ctrl-b with Alt-Up, Alt-Down, Alt-Left, Alt-Right for larger increments. However, tmux will automatically adjust these sizes if you then apply a layout command like even-horizontal or tiled.

Once you’ve mastered these basic layout commands, you’ll likely want to explore how to bind them to custom key combinations in your .tmux.conf file for quicker access.

Want structured learning?

Take the full Tmux course →