Tom Ordonez

Data Science, Machine Learning, Software Engineering

Remote Tmux Inside a Local Tmux


How to work with an SSH remote Tmux inside a local Tmux.

To provide some context, these are relevant blog posts:

I connect to another Linux laptop in my LAN using SSH. Then I use Tmux on that machine.

As seen here. You can dettach from a remote tmux session, if you are already in a local tmux session.

Inside your remote tmux SSH session. You have to use your prefix twice. My prefix is set to Ctrl+a, and I have my Ctrl key mapped to Caps.

After connecting SSH and opening tmux on that machine. You can dettach by using:

prefix prefix d

In my case I use:

Ctrl+a Ctrl+a d

This will dettach my remote tmux.

You can follow the same process to interact with your remote tmux SSH session.

To move to the next tab I use Ctrl+a n. To move to the next vertical split in the same tab I use Ctrl+a l to move to the right, and Ctrl+a h to move to the left.

For the remote tmux SSH session I do this:

Ctrl+a Ctrl+a n
Ctrl+a Ctrl+a l
Ctrl+a Ctrl+a h