Reputation: 5450
I have a local tmux session and I can do everything properly. Now I ssh to a remote machine and spawn a tmux session there. In the remote session, I would like to use all facilities like opening a new window, renaming a window, browsing through session-window tree etc. The problem is that whenever I use any such command, it is applied to the local session instead of the remote session! For example, ctrl
+ b
+ ,
to change the window name on remote, tries to rename the current local tmux window through which I have ssh-ed. This is true even when I have a blinking cursor in remote bash. How can I tell tmux that the command is to be executed on the remote machine, not on the local machine?
Upvotes: 4
Views: 2736
Reputation: 512
You will have to setup the below part in your .tmux.conf
:
bind-key b send-prefix
Now you can press ctrl-b + b + ,
to change the inner session window name. Since by default all commands go to the outermost session, you will have to use the bind-key to access your inner session.
ctrl-b + b + , # changes name of inner session (remote)
ctrl-b + , # changes name of outer session (local)
I am assuming that ctrl-b
is your default prefix key. By ctrl-b
, I mean ctrl + b
. ctrl-b + b + ,
means that you have to press ctrl
, press b
twice and then press ,
.
You can further use bind-key <key> send-keys <key1 key2>
to bind a key to send multiple keys together and access windows which are inside your remote instance. You can refer to this answer or this answer for more information.
Upvotes: 4