I would like to use my ssh tmux session inside my development tmux session, but it makes tmux behave bad (keys go to wrong session, etc). Is there a way to do it properly?
Asked
Active
Viewed 5,588 times
2 Answers
12
You can set up
bind-key b send-prefix
in your .tmux.conf
. By default all commands go to the outermost tmux session. If you press <prefix-key>
b (<prefix-key>
=ctrlb by default) the commands go to the inner session. Here an example:
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

Marco
- 849
- 1
- 7
- 21
10
At least on my machines, I need to press "the key" (prefix-key) twice, to get a command to the tmux inside the base tmux,
So if I from a tmux window, I ssh into a server and attach to a tmux session as @Marco described above, I need to do these:
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)
to make is super clear, ctrl-b-b
means hold down ctrl
press b
twice then release and press the command key, c
in the example above.

Ali
- 18,665
- 21
- 103
- 138