Difference between tmux suspend and tmux detach


           C-z         Suspend the tmux client.
           d           Detach the current client.

In both cases, I leave tmux, the sessions are still available, and I can re-attach to them at any time.

Can someone highligh the differences between the 2 features?

Best Answer

    1. Suspending the task sends SIGSTOP which pauses the client's process but does not terminate it.

      • If you ps wux | grep tmux it will show up as stopped 'T'
      • You can then resume it with either fg which brings the latest stopped task back to the foreground, or tmux attach.
      • It is worth noting that tmux attach will connect to the first session.
      • If you have 2 sessions, one suspended and one detached, tmux attach without a -t session-name will attach to the first one in the list.
      • Using fg, a bash command will simply resume the last suspended task, whether that's tmux or not.
    2. Detaching ends the client process.

      • ps wux | grep tmux wont show the detached session.
      • You can't resume it with fg but you can with tmux attach which creates a new client process to attach with.