32
8
I use tmux on my server and recently I found to my cost that ctrl-d will exit tmux and lose all the session information, my intention was to simply end the ssh session but failed to notice I was still in tmux until too late.
I am aware that I should be careful in future when using ctrl-d but I wondered if there a way to prevent tmux for exiting when hitting ctrl-d by accident? A solution such as a prompt, confirmation or detaching would be fine.
7That is excellent, thanks. I only needed it for tmux so I used
set-environment -g 'IGNOREEOF' 2
in.tmux.conf
and now I need to hit Ctrl-d 3 times to exit and I am also warned each time with the message:Use "logout" to leave the shell.
– Cas – 2012-09-26T10:43:21.7377Setting IGNOREEOF environment variable have no effect in zsh, but "set -o ignoreeof" or "setopt ignoreeof" does. – sgtpep – 2013-04-24T06:19:49.213