3

I'm using tmux to manage my windows, etc, and one of the things I do is SSH to a remote server and connect to a tmux session running there. Once there, however, I cannot sent C-b through to that tmux session (the one running in ssh in my original, local tmux).

Is there a way around this?

4

Press Ctrl-b once for the local tmux and again for the remote one, then the key for the command you want to use on the remote session.

  • 1
    Alternatively, change the prefix key for the tmux you've SSH'd into, and you don't have to hit anything twice. – Rob Dec 14 '11 at 17:35
2

If you haven't mapped Ctrl+b Ctrl+b

If you haven't mapped Ctrl+b Ctrl+b to last-window to emulate screen's behavior (which is quite popular), then you can use that as your prefix for the inner tmux session. So to issue commands to the inner session you would use Ctrl+b Ctrl+b Command

The above answer assumes your prefix key is still Ctrl+b on both machines.

If you have mapped Ctrl+b Ctrl+b

If you have mapped Ctrl+b Ctrl+b, then you'll need to use tmux's :send-prefix command. Many people map this to Ctrl+b b to emulate screen's default behavior. You would add this to your .tmux.conf to add this binding permanently:
bind b send-prefix

Then you can issue commands to the inner session using Ctrl+b b Command
(or without the binding using Ctrl+b :send-prefix Command)

The above answer assumes your prefix key is still Ctrl+b on the outer session.

0

In short you can add the following line into your tmux.conf to control "tmux inside tmux". This line define your bind key to CTRL+A for the "remote" session.

bind-key -n C-a send-prefix

The shortcut C-a can be change by any other free keys.

Then you can use CTRL+Bto control you tmux session level1 (default) and CTRL+Ato control the second tmux session.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.