As far as I understand, the hierarchy of things in tmux is like this: Sessions, which have Windows, which have Panes. Moving around things in this hierarchy using tmux commands is not trivial, especially since I don't see any globally unique pane identifiers around.

Is there maybe some built-in or external way to organize windows and panes in tmux, allowing me to list them as a hierarchy, thus allowing me to select one or more items and place them at a new location?

I expect it to look somewhat like this:

 [ ] 0: 5 windows (created Sun Dec  1 02:29:25 2019) [151x43] (attached)
 [ ]   0: boi (1 panes) [151x43] [layout b83d,151x43,0,0,0] @0
 [ ]   1: mnt (1 panes) [151x43] [layout b841,151x43,0,0,4] @4
 [ ]   2: vi (1 panes) [151x43] [layout b842,151x43,0,0,5] @5
 [*]   3: vi- (1 panes) [151x43] [layout b843,151x43,0,0,6] @6
 [*]   5: sink* (1 panes) [151x43] [layout b846,151x43,0,0,9] @9 (active)
 [ ] 1: 4 windows (created Sun Dec  1 02:30:53 2019) [151x43] (attached)
 [ ]   0: vi (1 panes) [151x43] [layout b83e,151x43,0,0,1] @1
>[ ]   1: vi (1 panes) [151x43] [layout b83f,151x43,0,0,2] @2
 [ ]   2: vi- (2 panes) [151x43] [layout 9749,151x43,0,0[151x21,0,0,3,151x21,0,22,12]] @3
 [ ]     0: [151x21] [history 979/1000, 549206 bytes] %3
 [ ]     1: [151x21] [history 0/1000, 0 bytes] %12 (active)
 [ ]   3: rust-fuse* (1 panes) [151x43] [layout 5c4f,151x43,0,0,10] @10 (active)

You can select one or more session/window/pane, cut/copy them from original locaiton and paste them to new location.

  • Such a graphical way to rearrange the panes would be just fantastic.
    – Rho Phi
    Jul 6, 2020 at 15:45

2 Answers 2


There are globally unique identifiers for panes, windows and sessions. Panes start with %, you can see them with tmux lsp.

I don't move stuff about very often so it is probably more fiddly than it could be.

The easiest way to do simple operations is to use the marked pane. Go to the pane you want to move or swap (outside tree mode, I mean make it the active pane) and then do C-b m to mark it. Then change to the window you want to join it to and do C-b : join-pane or the pane you want to swap it with and do C-b : swap-pane.

You can similarly swap or move windows using swap-window or move-window -k - they will use the window containing the marked pane.

I thought you could do it in tree mode but it doesn't actually work very well. Ideally you would be able to tag two panes with t and then do : swap-pane (no prefix, the tree mode command :) to swap them, but it doesn't work because it ends up with both targets being the tagged pane each time. This could definitely be improved...

  • tmux lsp ultimately shows just something like %10. There is another pane named %10 in another session. How to I make it show longer pane identifier?
    – Vi.
    Dec 2, 2019 at 11:09
  • Thanks, I never used marked panes before in tmux.
    – Vi.
    Dec 2, 2019 at 11:16
  • You do not have two panes %10 because they are unique, are you confusing pane ID %10 with a pane at index 10 in a window? Use tmux lsp -a to see all panes in all sessions. Dec 2, 2019 at 11:48
  • OK, I though at first they are only unique within a session or window...
    – Vi.
    Dec 2, 2019 at 11:56
  • Where are the simple beginner-friendly steps I added?
    – Vi.
    Dec 2, 2019 at 11:57

The tmux command choose-tree shows such a hierarchical list of panes-below-windows and windows-below-sessions. By default the w key runs this command with the -Z (zoomed) and -w (panes collapsed) options.

You can get at least half-way the interactivity you asked for by using this together with a template command. E.g. to move the active pane to a interactively chosen window, run this command:

choose-tree -Z "join-pane -t %%"

To make this actually useful, you'll probably want to create a key binding for it.

Many commands for manipulating windows and panes support these template commands. There are also ways to mark or tag panes/windows an do slightly other things with that. So there are surely ways take this further to your advantage.

Recent tmux's versions have a tree-mode list with more features. You may want to update your tmux for these features to be available.

BTW the more complete hierarchy is: client <-- session <-- window <-- pane that the target pane is now split and second part is the moved pane.

You must log in to answer this question.

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