Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move window between tmux clients

Tags:

linux

tmux

People also ask

How do I move a tmux window?

Pressing Ctrl+Shift+Left (will move the current window to the left.

How do I move a tmux pane to a new window?

For breaking a pane to a new window, use break-pane (whichcanalsobebound).


Yes, you can use the move-window command:

move-window [-d] [-s src-window] [-t dst-window]
           (alias: movew)

This is similar to link-window, except the window at src-window is moved to dst-window.

where src-window and dst-window have the form: session:window.pane (session and window can be either name or id).

So, supposing you have an 'chat' session with an 'irc' window and want to move it to the 'other_session' session you can do (in the tmux prompt):

move-window -s chat:irc -t other_session

If you are already in the chat:irc window you don't need to specify the source so

move-window -t other_session:

will do it.

In the same way, from the 'other_session' session you don't need to specify the target.

movew -d irc:irc_window

If you haven't named you windows/sessions, you have to use their ids.


Another useful one:

 link-window [-dk] [-s src-window] [-t dst-window]
               (alias: linkw)
         Link the window at src-window to the specified dst-window.  If dst-window is specified
         and no such window exists, the src-window is linked there.  If -k is given and
         dst-window exists, it is killed, otherwise an error is generated.  If -d is given, the
         newly linked window is not selected.

This means that you can share a window across multiple sessions:

Assuming I have these 2 sessions:  daemons and proj

tmux link-window -dk -s daemons:0 -t proj:0