Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 3 panes in my tmux window:

|             |      2   |
|             |          |
|        1    |----------|
|             |      3   |
|             |          |

Panes 1 and 2 have vim. Pane 3 runs a cli I am developing. Sometimes I want to compare panes 1 and 2, so I want to hide pane 3:

|             |          |
|             |          |
|        1    |       2  |
|             |          |
|             |          |

and then bring back pane 3 again. I don't want to kill pane 3 as I have set up some things there and don't want to go though setting them up again.

  • Is there something similar to PREFIX + z which can zoom pane 2 but without touching pane 1? Or
  • Is there a way to hide pane 3 quickly and bring it up back when needed?
share|improve this question
up vote 21 down vote accepted

Use the break-pane and join-pane commands. Refer to man tmux for details, options and usage.

Hide Pane 3:

Select pane 3 and enter Prefix-:break-pane -dP.

tmux will send pane 3 to a window in the background (the -d flag) and print some information about it in pane 2 (the -P flag). By default you'll see something like 1:2.0 (meaning: session:window.pane). Hit q to continue working.1

1With some practice you you will be able to drop the -P flag since you can predict the session:window.pane triplet: session defaults to the current session and pane defaults to 0 while window will be the next free window identifier.

Get Pane 3 back:

To get pane 3 and the layout back, select pane 2 and issue Prefix-:join-pane -vs 1:2.0 telling tmux to split pane 2 vertically (-v) and to join the (source) pane (-s) with identifier 1:2.0. Optionally you can drop either the session or the pane identifier. Note also that tmux stores a command line history, conveniently accessible with Prefix-:-Up.

You'll probably need some time to get the hang of it, but once you do, you'll surely be able to come up with custom key bindings that are convenient for you.

The question Moving tmux window to pane contains some useful information and tricks that might improve your workflow.

share|improve this answer
Clear instructions! Works smoothly for me, much better than my answer! – Bernhard Jul 22 '14 at 8:55
By default, the pane 3 will be broken into the last window, if you got 3 windows already in the current session, the pane will become Window 3(assume window starts from 0), so the 3 in "Window 3" depends on the the opened windows, how can I make this work in customed key bindings? – CodyChan Oct 19 '15 at 3:40

Instead of hiding pane 3, you could also cheat a bit, and make it very small, which will probably also work for your case.

When pane 2 is the active pane you can

PREFIX : resize-pane -D 40

Then, to move it up again, you can either

PREFIX : resize-pane -D 28

where you would have to replace 28 with a decent number, or, instead, you could try PREFIXEsc4, which does automatic resizing.

share|improve this answer
I was resizing the pane using set -g mouse-resize-pane on but other than resizing do we have any other option ? – user881300 Jul 22 '14 at 8:13
@user881300 I am not a tmux expert by any means, but I would be curious to learn if this is possible. – Bernhard Jul 22 '14 at 8:15
CTRL+B, ALT+<arrow direction to resize>, than CTRL+B, ESC, 4 (thx @Bernhard) to restore it. – FelikZ Aug 30 '15 at 9:03

An idea: run tmux in tmux.

Original set up:

Pane 1 and pane 2; side by side. Run vim in Pane 1 as normal.

In pane 2, run tmux again and create two panes (one on top of the other this time). Then run vim in pane 2.1 and your CLI in pane 2.2. This should allow you to full screen pane 2.1 with your second instance of Vim resulting in the behaviour you want.

share|improve this answer
Thanks for editing. Wasn't sure what was appropriate. – BinaryBen Jun 21 at 12:49
this is what I call out of box thinking ! – user881300 Jun 23 at 0:14
Thanks user881300. It has some flaws (being able to send commands has a few quirks for e.g.). I hope to update this into a more complete answer once I have tested it - I need similar functionality myself. – BinaryBen Jun 23 at 7:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.