Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

How do I move an existing pane into another window in tmux when I have multiple windows, and vice versa?

I'm coming from screen, where I can switch to the pane and then switch windows until I get to the one I want; tmux does not seem to allow this.

share|improve this question
up vote 130 down vote accepted

The command to do this is join-pane in tmux 1.4.

join-pane [-dhv] [-l size | -p percentage] [-s src-pane] [-t dst-pane]  
    (alias: joinp)
    Like split-window, but instead of splitting dst-pane and creating
    a new pane, split it and move src-pane into the space.  This can
    be used to reverse break-pane.

To simplify this, I have these binds in my .tmux.conf for that:

# pane movement
bind-key j command-prompt -p "join pane from:"  "join-pane -s '%%'"
bind-key s command-prompt -p "send pane to:"  "join-pane -t '%%'"

The first grabs the pane from the target window and joins it to the current, the second does the reverse.

You can then reload your tmux session by running the following from within the session:

$ tmux source-file ~/.tmux.conf
share|improve this answer
I'm trying this method but when I put your code into my .tmux.conf file and do Ctrl-b, j, nothing seems to happen. – mrlanrat Jun 3 '11 at 4:19
You need at least 2 windows open, with a couple panes in each: then hit Prefix+s and enter the window name at the prompt to send the pane to that window... – jasonwryan Jun 3 '11 at 4:28
I am still not having any luck with this, nothing happens. I get the feeling tmux is not reading the .tmux.conf file because it does not respond at all to Ctrl-b, j or Ctrl-b, s. (these are the only 2 lines in the config file) – mrlanrat Jun 3 '11 at 5:22
Have you reloaded the .conf file after creating it? Ctrl-b r? – jasonwryan Jun 3 '11 at 5:59
@mrlanrat I find that you must prefix the window number with a colon. See my answer below. – Bruno Bronosky Feb 1 '12 at 16:17

join-pane is the answer. I too was having problems with my attempts to use it based on the tmux documentation. I discovered that the -t and -s switches seem to accept [session]:window and not [session:]window. That is to say that specifying the session is optional, but including the : is mandatory. (I am using tmux 1.5)

Therefore, in order to add a pane to the current window and place window 1 into the pane, the command would be (Ctrl-B or whatever your bind key is, followed by)...

:join-pane -s :1

You can then break them appart with break-pane which by default is: Ctrl-B ! If you want to bind it to a shortcut, I suggest NOT overriding a default binding like s, because down the road you will look on the internet for an answer that involves choose-session and it will not work on your system. Notice that break-pane is bound to ! and @ is right next to it and not bound to anything by default. For that reason I suggest this binding...

bind-key @ command-prompt -p "create pane from:"  "join-pane -s ':%%'"

The most important thing is that your LEARN "join-pane -s :" because if you just set it and forget it, you will be gimped when you find yourself on a foreign server. And let's face it, the most important thing a terminal multiplexer gives you is reliable sessions on remote servers.

This completes my conversion from GNU Screen to Tmux. I'll never look back.


share|improve this answer
Thanks, this is exactly what I needed. – dsummersl Aug 22 '12 at 18:12
I'd been missing the ':' as well...thanks for this. – rascalking Sep 20 '12 at 19:03
I got 2 down votes on this recently with no comments suggesting why. That's just rude and anti-FOSS culture. – Bruno Bronosky Nov 10 '15 at 17:28

I think I like what I've been using for moving panes to their own window better. I use

break-pane -t :

I figured it out through experimentation, but it seems to work very well. You can keybind or alias it easily, no scripting required.

share|improve this answer
+1. I tend to use this much more often than join-pane. – Chris B Nov 21 '12 at 3:51

If you don't want to type the pane identifier into a prompt, you can also use

bind-key j "join-pane -s !"

which will join the last active pane/window to the current window.

share|improve this answer
Which version are you using? I'm getting unknown command: join-pane -s ! with 1.6. – paradroid Aug 28 '12 at 17:00
Using 2.0 here, but just putting the line into the conf without quotes seems to work fine. bind-key j join-pane -s ! – bkzland Feb 17 at 13:50

After looking through the other answers and perusing the tmux man page I settled on the following bindings for now:

bind-key S choose-window 'join-pane -v -s "%%"'
bind-key V choose-window 'join-pane -h -s "%%"'

This will let you interactively select the window to join, and mirrors my lowercase s/v bindings to create new vertical/horizontal splits. If anybody knows how to select individual panes instead of windows let me know.

share|improve this answer

You don't have to change your key bindings.

Whilst the pane you wish to move has focus, type Prefix then :join-pane -t :1 where 1 is whatever the destination window's number is in the same session. You can move it to another session by prepending its name like project:3. For me join-pane tab-autocompletes from j.

Add an -h or -v switch to the command to set the orientation of the new split created in the destination, or just go to it and Prefix + space to rearrange.

share|improve this answer

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.