当您从本地tmux会话SSH到删除tmux会话时,如何将命令键传递到远程tmux会话

Sła*_*osz 9 linux ssh tmux

我想在我的开发tmux会话中使用我的ssh tmux会话,但它会使tmux表现不好(密钥转到错误的会话等).有没有办法正确地做到这一点?

Mar*_*rco 9

你可以设置

bind-key b send-prefix
Run Code Online (Sandbox Code Playgroud)

在你的.tmux.conf.默认情况下,所有命令都转到最外层的tmux会话.如果按<prefix-key>b(<prefix-key>= ctrlb默认情况下),命令将转到内部会话.这是一个例子:

ctrl-b   c  # create new window in the outer session
ctrl-b b c  # create new window in the inner session
ctrl-b   %  # create split window in the outer session
ctrl-b b %  # create split window in the inner session
Run Code Online (Sandbox Code Playgroud)


Ali*_*Ali 9

至少在我的机器上,我需要按两次"键"(前缀键),以获取基本tmux内的tmux命令,

因此,如果我从tmux窗口,我ssh到服务器并附加到tmux会话,如上所述@Marco,我需要这样做:

ctrl-b-b c # create a new window on the server (remote tmux)
ctrl-b   c # create a new window on my desktop (local tmux)
Run Code Online (Sandbox Code Playgroud)

要提出的是超清晰,ctrl-b-b指按住ctrl按下b然后松开两次,按命令键,c在上面的例子.