Resize Panes in Tmux

In this series of managing the tmux utility, the first level division, panes, are considered.

Panes divide the terminal window horizontally or vertically. Various combinations of these splits can result in different layouts, according to your liking.

Pane split of a tmux window

This is how panes work in tmux.

Creating Panes

Take into focus any given pane. It could be a fresh window as well.

The current window can be split horizontally (up and down) with the key

[Ctrl+B] + "
Horizontal Split

And to split the pane vertically, use the combination

[Ctrl+B] + %
Vertical Split

Resizing your panes

Tmux uses 'cells' to quantify the amount of resizing done at once. To quantify, this is what resizing by 'one cell' looks like. One more character can be accommodated on the side.

Resizing by 'one cell'

The combination part is a bit tricky for resizing. Stick with me.

Resize by one cell

Use the prefix Ctrl+B followed by Ctrl+arrow keys to resize in the required direction.

[Ctrl+B] Ctrl+arrow

This combination takes a fair number of keypresses, but can be precise.

0:00
/0:08

Resize by five cells (quicker)

Instead of holding the Ctrl key, you could use the Alt key to resize faster. This moves the pane by five cells.

[Ctrl+B] Alt+arrow
0:00
/0:12

Resize by a specific number of cells (advanced)

Just like before, the command line options can resize the pane to any number of cells.

Enter the command line mode with

[Ctrl+B] + :

Then type

resize-pane -{U/D/L/R} xx
  • U/D/L/R represents the direction of resizing
  • xx is the number of cells to be resized

To resize a pane left by 20 cells, this is the command:

resize-pane -L 20
0:00
/0:06

Resizing left by 20 cells

Similarly, to resize a pane upwards, the -U tag is used instead.

0:00
/0:05

Resizing upwards by 15 cells

This resize-pane command could be primarily incorporated into reprogramming a tmux layout whenever a new session is spawned.

Conclusion

Since the pane lengths are always bound to change, knowing all the methods to vary the pane sizes can come in handy. Hence, all possible methods are covered.

Pro tip 🚀 - If you make use of a mouse with tmux, your cursor is capable of resizing the panes.

0:00
/0:15

Turning on mouse mode and resizing the panes

Go ahead and tell me which method you use in the comments.