Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to make GNU Screen not close if I end all its subprocesses? Ideally, it would create a new window running a shell if I accidentally closed the last window.

share|improve this question
up vote 9 down vote accepted

Assuming you're using bash and accidentally closes the shell with Ctrl-D, you can

export IGNOREEOF=1

This will give you a warning and require you to press Ctrl-D twice, or type exit instead.

share|improve this answer
Thanks! I added this to my ~/.screenrc: setenv IGNOREEOF 10 / screen -t main bash / unsetenv IGNOREEOF – P-Nuts Jun 24 '11 at 15:40
+1 because there's no part of my life that hasn't been improved after learning that! – EightBitTony Jun 24 '11 at 16:09
I did some more investigation and if you search for "Suddenly the Dungeon collapses!!" in attacher.c, it should be possible to change the code to spawn a new window somehow, instead of shutting down the whole thing. The source is just one quick git clone away: git://git.sv.gnu.org/screen.git – Alexander Jun 24 '11 at 16:47
Haha! I don't really want to go to the effort of maintaining my own patch to Screen, but thanks for reminding me of the Nethack option. (Though I was more of an Angband man myself...) – P-Nuts Jun 24 '11 at 22:18

I don't know of a way to do that specifically, but I find zombie {} useful; when I close a window, it prompts me to hit { or } to close or reopen it, respectively.

share|improve this answer
can this be used without having a screenrc? – Janus Troelsen Jul 18 '15 at 9:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.