在 tmux 客户端之间移动窗口

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

21986 次浏览

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

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

这与 link-window 类似,只不过 src-window 的窗口被移动到 dst-window。

其中 src-window 和 dst-window 的格式为: session: window.panel (session 和 window 可以是 name 或 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:

会做的。

同样,在‘ other _ session’会话中,不需要指定目标。

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.

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

Assuming I have these 2 sessions:  daemons and proj


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