You can split your terminal into multiple panes with tmux, and it’s way more powerful than just making two windows side-by-side.

Here’s a tmux session with three panes: a large one on the left for coding, and two stacked vertically on the right, one for logs and one for git commands.

+---------------------+---------------------+
|                     |                     |
|                     |       Pane 2        |
|       Pane 1        +---------------------+
|                     |       Pane 3        |
|                     |                     |
+---------------------+---------------------+

You create these splits using simple keybindings. To split the current pane vertically (creating panes stacked on top of each other), you press Ctrl-b %. If you want to split horizontally (creating panes side-by-side), you press Ctrl-b ".

Let’s say you have a single pane open. You want to split it into two, with one above the other.

+---------------------+
|                     |
|       Pane 1        |
|                     |
+---------------------+

You press Ctrl-b %. Now you have:

+---------------------+
|       Pane 2        |
+---------------------+
|       Pane 3        |
+---------------------+

Pane 2 is the one you were just in. Pane 3 is the new one below it. You can navigate between them using Ctrl-b followed by an arrow key (Ctrl-b Up, Ctrl-b Down, Ctrl-b Left, Ctrl-b Right).

Now, let’s take that setup and split Pane 2 horizontally.

+---------------------+
|       Pane 2        |
+---------------------+
|       Pane 3        |
+---------------------+

You navigate to Pane 2 (Ctrl-b Up if you’re in Pane 3). Then you press Ctrl-b ".

+---------------------+
|       Pane 2a       |
+---------------------+
|       Pane 2b       |
+---------------------+
|       Pane 3        |
+---------------------+

Pane 2a is the top half, and 2b is the bottom half. Pane 3 is still the original pane below.

The real magic happens when you start combining these. You can create a grid of panes with different sizes. tmux doesn’t force them to be equal; you can resize them. To resize, you enter "command mode" by pressing Ctrl-b :, then type resize-pane -D 5 to move the current pane’s bottom edge down by 5 lines, or resize-pane -U 5 to move it up. Similarly, -L moves left and -R moves right.

You can also swap panes. If you want Pane 3 to be on top and Pane 2 (with its sub-panes) to be below, you can navigate to Pane 3 and press Ctrl-b o to cycle through panes, or Ctrl-b { to swap the current pane with the previous one, and Ctrl-b } to swap with the next.

The layout I showed at the start with one large pane and two smaller ones stacked is a common pattern. You’d start with a single pane, split it vertically (Ctrl-b %), then navigate to the right pane (Ctrl-b Right) and split it horizontally (Ctrl-b "). Then, you’d resize the left pane to be wider and the right-hand panes to be narrower.

tmux panes are not windows. Windows are full-screen views, and you can have multiple windows within a single tmux session. Panes are subdivisions of a single window. This distinction is crucial for understanding how tmux manages its interface.

You can also have tmux automatically arrange your panes. If you have several panes and want them tiled nicely, you can use Ctrl-b followed by `` ` (backtick) to arrange them in a "tiled" layout, which tries to make them as equal as possible.

The most surprising thing is how easily you can script these layouts. You can create a .tmux.conf file with commands like bind v split-window -h and bind s split-window -v, which remap your split keys to Ctrl-v for vertical and Ctrl-s for horizontal (note that Ctrl-s is often a terminal flow control character, so you might need to stty -ixon in your shell or configure tmux to handle it).

The next thing you’ll want to figure out is how to make these pane layouts persistent across tmux sessions.

Want structured learning?

Take the full Tmux course →