DEV Community

Play Button Pause Button
Michael Lee 🍕
Michael Lee 🍕

Posted on • Updated on • Originally published at michaelsoolee.com

Resizing panes in tmux

One of the tools I use daily as a developer is tmux. Being able to have multiple panes in a single terminal window has definitely improved my workflow.

By default when creating panes, tmux will split the window up into 50% splits. But what if you don't need certain panes to have so much real estate and focus? You just want a small pane to keep an eye on things.

To resize tmux panes, you'll first want to hit your prefix — ctrl + b by default — and then the colon key :. What this does is brings up a prompt at the bottom of your screen.

Now you'll want to type in resize-pane in the prompt, followed by a hyphen - and either D, U, L, R. Which you can probably guess stands for down, up, left and right, the direction in which you want your pane to be resized. When using the resize-pane command, the resize will be applied to the last pane that had focus.

Here is an example of the entire resize pane command that resizes the pane to the left by a cell — the unit in which tmux resizes:

// This assumes that you've hit ctrl + b and : to get to the command prompt
:resize-pane -L
Enter fullscreen mode Exit fullscreen mode

Here are some additional tmux pane resizing examples:

:resize-pane -D (Resizes the current pane down by 1 cell)
:resize-pane -U (Resizes the current pane upward by 1 cell)
:resize-pane -L (Resizes the current pane left by 1 cell)
:resize-pane -R (Resizes the current pane right by 1 cell)
:resize-pane -D 10 (Resizes the current pane down by 10 cells)
:resize-pane -U 10 (Resizes the current pane upward by 10 cells)
:resize-pane -L 10 (Resizes the current pane left by 10 cells)
:resize-pane -R 10 (Resizes the current pane right by 10 cells)
Enter fullscreen mode Exit fullscreen mode

For more tmux tips, check out my site. If you've got questions with what's covered in the video or article, feel free to hit me up on Twitter @michaelsoolee.

Latest comments (1)

Collapse
 
testfailed profile image
testfailed

I also found it useful when I want to set the pane height(width) with an absolute value.

usage: resize-pane [-DLRUZ] [-x width] [-y height] [-t target-pane] [adjustment]
Enter fullscreen mode Exit fullscreen mode

ie.

resize-pane -t 1 -y 5
Enter fullscreen mode Exit fullscreen mode

In tmux can I resize a pane to an absolute value - Stack Overflow