Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am often logged in through multiple SSH sessions. To logout from my sessions, I press CTRL+d, until I am back on my local machine.

However, sometimes I press once too many, and my terminal exits.

Is there a way to block CTRL+d from closing my terminal ?

I am using terminator as my terminal emulator

share|improve this question

2 Answers 2

up vote 9 down vote accepted

You can also disable eof generally in bash:

set -o ignoreeof

share|improve this answer
1  
But if you do that indiscriminately, it'll apply when logged in over ssh as well. –  Gilles Jun 25 at 23:17

You can use the IGNOREEOF environment variable in bash. So export IGNOREEOF=42 and you'll have to press Ctrl+D forty-two times before it actually quits your shell.

POSIX set has an -o ignoreeof setting too.

share|improve this answer
    
Forty-three times: the first forty-two are ignored, and the last one actually quits. :-) –  deltab Jun 25 at 15:49
    
I figured Forty-three times would be too redundant. Definately the set -o ignoreeof would be more practical –  ryekayo Jun 25 at 15:57
2  
But if you do that indiscriminately, it'll apply when logged in over ssh as well. –  Gilles Jun 25 at 23:17

Your Answer

 
discard

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.