在tmux客户端之间移动窗口


114

我只是在学习tmux,没有屏幕经验。我想知道是否可以将一个tmux客户端中的窗口移动到另一个tmux客户端中。我想将IRC客户端移动到屏幕上的新窗口。

Answers:


180

是的,您可以使用move-window命令:

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

这类似于链接窗口,除了src-window的窗口移至dst-window。

其中src-window和dst-window的格式为:session:window.pane(session和window可以是name或id)。

因此,假设您有一个带有“ irc”窗口的“聊天”会话,并且想要将其移至您可以执行的“ other_session”会话中(在tmux提示符下):

move-window -s chat:irc -t other_session

如果您已经在chat:irc窗口中,则无需指定来源,因此

move-window -t other_session:

会做的。

同样,从“ other_session”会话中,您无需指定目标。

movew -d irc:irc_window

如果您尚未命名Windows /会话,则必须使用其ID。


42

另一个有用的:

 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.

这意味着您可以在多个会话之间共享一个窗口:

Assuming I have these 2 sessions:  daemons and proj

tmux link-window -dk -s daemons:0 -t proj:0
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.