Is it possible to create a new tmux window with the same panes layout as the current window?

  • Please expand on "duplicate" and "preserving panes": do you mean duplicating everything, all the way down (creating new pseudo terminals and starting new processes in them)? Or creating a new window that shows the exact same panes, with the same pseudo-terminals and already-running processes?
    – JigglyNaga
    Sep 28, 2018 at 12:54
  • 1
    I mean creating a new window with the same panes layout.
    – feedMe
    Sep 28, 2018 at 17:46

1 Answer 1


tmux does not have a built-in feature to do that.


What tmux does have is many simpler commands that can be called either within tmux or externally, eg. from the command line or a shell script. Most relevant to your needs is list-windows:

 list-windows [-a] [-F format] [-t target-session]
               (alias: lsw)
         If -a is given, list all windows on the server.  Otherwise,
         list windows in the current session or in target-session.  For
         the meaning of the -F flag, see the FORMATS section.

The output from this includes the layout of each window, so a script could parse that information and send tmux further commands (new-window, split etc.) to create another window with the exact same layout.

3rd-party tools

As an alternative to writing the whole script, you could use one of several tools that other tmux users have already created, that simplify setting up sessions/layouts. Each of the following allows a layout to be described in YAML:

From the Teamocil README:

You can grab the layout for the current window by running this command:

  tmux list-windows -F "#{window_active} #{window_layout}" | grep "^1" | cut -d " " -f 2

You can then use the result as the layout key for any Teamocil window object.

  - name: sample-two-uneven-panes
    layout: 00c7,158x38,0,0[158x9,0,0,37,158x28,0,10,39]
      - echo foo
      - echo bar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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