Score:4

tmux session must exit correctly on clicking close button

ca flag

How can a tmux session exit correctly i.e. completely on the quit/exit by way of clicking terminal window's close button, as it'll keep the tmux session remains on its OS pid

Artur Meinild avatar
vn flag
What do you mean by "correctly"? I think you're missing the entire point of tmux.
Vercingatorix avatar
ve flag
It's not a bug; it's a feature. `tmux` is meant to be used where connectivity is spotty so your session persists in the face of adversity. In other words, it's not *supposed* to exit under these circumstances, as @ArturMeinild pointed out in his answer. What are your goals in using `tmux`, or what problem are you trying to solve that prompted you to use it?
Score:9
vn flag

One of tmux's design goals is that the session persists when you close the terminal.

So by default, if you want to close a tmux session, you must actively do so with the command:

tmux kill-session -t <session-name>

If you somehow wish to disable the default behavior, you can set the destroy-unattached option in your ~/.tmux.conf file, like this:

set-option -g destroy-unattached on

With this option set, tmux will automatically close any sessions not attached to a client.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.