02. Pane Management & Ex-Commands tmux

*If you're looking instead for pain management go here instead.

Recall from the diagram above that panes are the lowest level of interface. Let's learn how to manage these panes.

Tmux organizes its terminals into sessions, windows and panes.
Tmux organizes its terminals into sessions, windows and panes.

7 Commands for Managing Panes

1) Splitting a Window into Panes

You can split a window either horizontally or vertically to create two panes:

<Ctrl-b> "
<Ctrl-b> %

As practice, try obtaining the following panes:

Try obtaining the following four panes.
Try obtaining the following four panes.

2) Navigating along Panes

Moving from one pane to the next is easy - simply use:

<Ctrl-b> [Up/Down/Right/Left]

You'll notice that if there doesn't exist a pane in an inputted direction, the tmux won't navigate at all.

Great! Now try navigating back to the first pane and splitting it horizontally.

Split the first pane horizontally to obtain the following.
Split the first pane horizontally to obtain the following.

You can also move to the previous pane with:

<Ctrl-b> ;

Lastly, you may move to the current pane on the left and right with the below keystrokes:

<Ctrl-b> {
<Ctrl-b> }

The above keystrokes seem buggy if you're using Mac OS X, so it may be best to stick with the arrow keys. Try moving along all of your panes for practice.

3) Resizing Panes

To resize a particular pane, navigate to the one you'd like that pane and type:

<Ctrl-b> <Ctrl-[Up/Down/Left/Right]>

Try changing your pane sizes to look like this:

More fun practice with pane resizing!
More fun practice with pane resizing!

Are your resizing keys bound to something else? Hang on tight, Mac OS X users! You may still resize your panes with ex-commands as explained below.

4) Rotating Panes

In case you don't like the positions of all panes, you may rotate them.

<Ctrl-b> <Ctrl-o>

5) Show Pane Numbers

Sometimes you'll need to show pane numbers to switch among panes.

<Ctrl-b> q
Showing pane numbers on tmux.
Showing pane numbers on tmux.

6) Closing a Pane

To close a pane type:

<Ctrl-b> x

You'll be prompted with a warning before the closing occurs.

Another way to close the window is to simply type exit at the specific pane's command line.

Ex-Commands

Every command that we've inputted so far are simply shortcuts to actual text commands. If we want to input commands instead of using keys, we may enable ex-mode by typing:

<Ctrl-b> :

For example, if you're on a Mac OS X, the keys used to resize panes may be bound to another feature. No worries! We can still resize panes using ex-commands. Type in your control key, followed by a colon to activate ex-mode:

Activating ex-mode and extended a pane 10 units down.
Activating ex-mode and extended a pane 10 units down.

You should now see a yellow status bar with a colon, waiting for a command to be inputted. Type in resize-pane, then one of the following commands to resize the current pane:

-D 10
Resizes pane down 10 cells.
-U 10
Resize pane upward 10 cells.
-L 10
Resize pane left 10 cells.
-R 10
Resize pane right 10 cells.
-t 2 30
Resize pane of id 2 down 30 cells.

Now try resizing the panes from the "Resizing Panes" section above. There are a ton of other ex-commands all listed in tmux's man page.

Great! By now you should be a tmux pane manager expert. Let's move onto managing windows.

Aching back from coding all day?

Acupressure Mat & Pillow

Aching back from coding all day? Try Back Problems

Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.

$$ Check price
144.87144.87Amazon 4.5 logo(1,890+ reviews)

More Back Problems resources

Take your Linux skills to the next level!

Command Line Kung Fu

Take your Linux skills to the next level! Try Linux & UNIX

Command Line Kung Fu is packed with dozens of tips and practical real-world examples. You won't find theoretical examples in this book. The examples demonstrate how to solve actual problems. The tactics are easy to find, too. Each chapter covers a specific topic and groups related tips and examples together.

$ Check price
14.9914.99Amazon 4.5 logo(27+ reviews)

More Linux & UNIX resources

Ad