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.

Take your Linux skills to the next level!

The Linux Command Line

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

The Linux Command Line takes you from your very first terminal keystrokes to writing full programs in Bash, the most popular Linux shell. Along the way you'll learn the timeless skills handed down by generations of gray-bearded, mouse-shunning gurus: file navigation, environment configuration, command chaining, pattern matching with regular expressions, and more.

$ Check price
39.9539.95Amazon 4.5 logo(274+ reviews)

More Linux & UNIX resources

Aching back from coding all day?

Inversion Therapy Table

Aching back from coding all day? Try Back Problems

Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.

$$ Check price
119.98119.98Amazon 4.5 logo(1,700+ reviews)

More Back Problems resources

Ad