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.

8 Answers 8


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
  • 1
    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
    Commented Jun 3, 2011 at 4:19
  • 3
    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
    Commented Jun 3, 2011 at 4:28
  • 11
    @mrlanrat I find that you must prefix the window number with a colon. See my answer below. Commented Feb 1, 2012 at 16:17
  • 1
    Great. Since i'm using h j k l to move "vi style" between panes, i used > and < to "send pane" and "bring pane" from windows.
    – user34720
    Commented Dec 9, 2016 at 12:55
  • 4
    What does the '%%' refer to?
    – oligofren
    Commented Jul 2, 2019 at 8:43

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 apart 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 ':%%'"

Alternately, to have an interactive chooser...

bind-key   @ choose-window 'join-pane -h -s "%%"'
bind-key C-@ choose-window 'join-pane    -s "%%"'

Alternately, to always join the most recently visited window...

bind-key @ join-pane -h -s !

NOTE: The -h causes it to stack the panes horizontally (with a vertical split) as opposed the default behavior which is the reverse.

The most important thing is that your LEARN whatever you choose to shortcut. 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.


  • 7
    I'd been missing the ':' as well...thanks for this.
    – rascalking
    Commented Sep 20, 2012 at 19:03
  • 3
    documentation doesn't talk about colons at all! Nice one
    – JonnyRaa
    Commented Nov 24, 2017 at 9:45
  • 6
    Using the dot syntax is what helped me window.pane for example join-pane -s 1.0 to move pane 0 in window 1 into the current window. More details at maciej.lasyk.info/2014/Nov/19/tmux-join-pane
    – mbigras
    Commented Aug 1, 2018 at 4:45
  • 2
    As of tmux 2.1, the : apparently isn't required anymore (e.g., just do :join-pane -s 1). Maybe that was a bug in earlier versions
    – villapx
    Commented Nov 1, 2018 at 16:16
  • 5
    just to add a bit more documentation, it goes to another level aswell where you can use . as in [session:]window[.pane] to specify which pane of a window to take... only needed for multiple pane windows and (perhaps this is newer tmux) you can omit session in this case aswell
    – JonnyRaa
    Commented May 11, 2020 at 16:26

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.

  • 4
    +1. I tend to use this much more often than join-pane.
    – Chris B
    Commented Nov 21, 2012 at 3:51
  • 2
    just wow.......
    – vdegenne
    Commented Jan 8, 2020 at 15:30
  • 3
    This is the answer for moving a Pane to its own separate Window. Thank you.
    – FilBot3
    Commented Jan 20, 2021 at 14:39
  • 1
    Great, exactly what I needed, thank you!
    – Mike Bell
    Commented Mar 17, 2022 at 22:09
  • 1
    This makes most sense! join-pane swapped my pane instead
    – Hritik
    Commented Oct 12, 2023 at 13:34

Key binding

By default, Ctrl+b, ! would break the active pane into a new window and switch to it.

Where Ctrl + b is the default prefix for .


The tmux command this key executes is break-pane (alias: breakp) as implemented in cmd-break-pane.c and bound as default in key-bindings.c as seen in list-keys (alias: lsk) command output:

bind-key    -T prefix       !                 break-pane

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.

  • 1
    This is very helpful. Thank you. Unfortunately the -v and -h do not create vertical and horizontal "splits" respectively. They create vertical and horizontal "stacked panes" respectively. (That is to say that vertically stacked panes have a horizontal split.) So you have to train your brain that way. Also -v is the default, so I'd leave that out and only put the -h in there so that your ~/.tmux.conf acts as a cheat sheet for you to look at. Commented Nov 13, 2017 at 18:58
  • I like this better than the other answers for "opposite of break-pane". Having broken a pane free into its own window temporarily, later I want to send it back to one of the older windows and this handles that gracefully.
    – Stabledog
    Commented Jul 26, 2019 at 13:29

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.

  • 1
    Which version are you using? I'm getting unknown command: join-pane -s ! with 1.6.
    – paradroid
    Commented Aug 28, 2012 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
    Commented Feb 17, 2016 at 13:50

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.


here is the bring pane from as a fzf-tmux function.

just put this in some file:

function bring_pane() {
        tmux list-windows -F "#{window_active} #{window_index} #{window_name}" | sort -r | awk '{print $2 " : " $3}' \
            | fzf-tmux -p --border-label="Bring pane" | awk '{print $1}' | sort -r
    if [ -n "$windows" ]; then
        echo $windows | xargs -n1 -I {i} tmux join-pane -s {i}

Then in your tmux config source it:

bind-key i run-shell "source ~/.tmux/functions.sh && bring_pane"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .