Detach

Detach is a tmux operation that disconnects the current client from a session while allowing that session to continue running in the background. When you detach from a tmux session by pressing CTRL + B followed by D, the session persists on the server with all processes and windows intact. This separation between the client connection and the session itself is fundamental to tmux’s design.

Use Cases

Detaching is useful when you need to close your terminal or end your connection without stopping long-running processes. A detached session can be reattached later from the same machine or a different one, allowing you to resume work exactly where you left off. This makes tmux particularly valuable for remote work over SSH or when managing processes that need to survive across multiple login sessions.

Reattaching

Sessions that have been detached remain accessible through the tmux attach command (or tmux attach-session). You can list all available sessions with tmux list-sessions to see which ones are currently detached and waiting to be reconnected.

Source Notes