【发布时间】:2023-03-20 10:10:01
【问题描述】:
我只是在学习 tmux,对屏幕没有经验。我想知道是否可以将一个 tmux 客户端中的窗口移动到另一个 tmux 客户端。我想将 IRC 客户端移动到屏幕上的新窗口。
【问题讨论】:
我只是在学习 tmux,对屏幕没有经验。我想知道是否可以将一个 tmux 客户端中的窗口移动到另一个 tmux 客户端。我想将 IRC 客户端移动到屏幕上的新窗口。
【问题讨论】:
是的,你可以使用 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.pane(会话和窗口可以是名称或 id)。
因此,假设您有一个带有“irc”窗口的“聊天”会话,并且想要将其移动到您可以执行的“其他会话”会话(在 tmux 提示符中):
move-window -s chat:irc -t other_session
如果您已经在 chat:irc 窗口中,则无需指定来源
move-window -t other_session:
会做的。
同样,在“other_session”会话中,您不需要指定目标。
movew -d irc:irc_window
如果您尚未命名窗口/会话,则必须使用它们的 ID。
【讨论】:
另一个有用的:
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
【讨论】: