分离 *other* tmux 客户端

Pau*_*rth 32 tmux

我在桌面上工作时使用 tmux,然后如果我想在笔记本电脑上在户外工作,我会通过 ssh 连接到桌面并附加到同一个会话。然后,当我关闭笔记本电脑并返回内部时,桌面上可见的会话会缩小,仅显示较小笔记本电脑屏幕上可用的行/列。无需再次打开我的笔记本电脑,是否有某种方法可以强制笔记本电脑与会话分离?或者至少调整 tmux 的大小以使用桌面屏幕上的所有可用空间?

dem*_*ure 44

默认情况下,<prefix> D为您提供已连接客户端的列表,您选择的任何一个都已断开连接。

您还可以choose-client从命令行使用作为 tmux 的增强,或在 tmux 的命令行中使用<prefix> :

其中前缀C-b默认为

  • @ThomasAhle 'D' 是大写字母。小写的“d”会断开您当前的连接。 (6认同)
  • 是的,我知道 `&lt;prefix&gt; d`,但我很少这样做,因为如果我起床吃午饭或做伸展运动,我可能不知道我是要从办公室还是在后廊继续工作。:-) (2认同)

Gau*_*ava 13

你也可以这样做

tmux attach -t <tmux_session_name> -d
Run Code Online (Sandbox Code Playgroud)

这将分离所有其他附加的客户端,并附加这个新客户端。

  • 如果只有一个会话,`tmux a -d` 就可以了。 (5认同)

小智 10

如果尚未进入 tmux 会话,您可以像这样分离“其他”客户端:

tmux detach-client
Run Code Online (Sandbox Code Playgroud)

来自 tmux 手册页:

detach-client [-P] [-a] [-s target-session] [-t target-client]
               (alias: detach)
         Detach the current client if bound to a key, the client specified with -t, 
or all clients currently attached to the session specified by -s.  The
         -a option kills all but the client given with -t.  If -P is given, send 
SIGHUP to the parent process of the client, typically causing it to exit.
Run Code Online (Sandbox Code Playgroud)