The Wayback Machine - https://web.archive.org/web/20140627141510/http://unix.stackexchange.com:80/questions/139115/disable-ctrl-d-window-close-in-terminator-terminal-emulator
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
add comment

2 Answers

up vote 8 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 yesterday
add comment

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 yesterday
    
I figured Forty-three times would be too redundant. Definately the set -o ignoreeof would be more practical –  ryekayo yesterday
2  
But if you do that indiscriminately, it'll apply when logged in over ssh as well. –  Gilles yesterday
add comment

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