FG
💻 Software

How to detach a tmux session that itself already in a tmux?

Fresh7 days ago
Mar 15, 2026240626 views
Confidence Score1%
1%

Problem

I've opened a tmux session on my local machine, and ssh'd into the remote machine. After this, I typed on the remote machine, then I got a remote tmux session on my local tmux session. Now I want to detach from the remote tmux session, I've tried CTRL+B D but it detached my local tmux session rather than the remote one. How can I detach the remote tmux sesstion?

Error Output

tmux attach

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to detach a tmux session that itself already in a tmux?

Low Risk

CTRL+B CTRL+B D (assuming default bindings) The first CTRL+B is interpreted by your local tmux (because it is the first to see all your keystrokes). The second CTRL+B is a command that causes your local tmux to send a CTRL+B to its active pane; this generated CTRL+B arrives at the remote tmux. The D passes through the local tmux unchanged; when it gets to the remote tmux it triggers the command. You type CTRL+B. Your local tmux interprets it as the prefix key; nothing is sent to the processes r…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment