I don't know what I have changed, but if I am on a terminal and I press Ctrl+a+d (that is, the three keys simultaneously) the terminal is killed. This is on gnome-terminal on Ubuntu and using zsh as the default login shell.

I checked the keyboard shortcuts on gnome-terminal (on the GUI, under Edit->Keyboard Shortcuts) and searched for bindkey statements that may trigger this undesired shortcut in my home directory but found nothing.

I am pretty sure that this is new behavior (last couple of days) since I frequently type Ctrl-a to go to the beginning of a line on my terminal and then Ctr-d to delete characters, and if I do this at the moment, it triggers this undesired keyboard shortcut.

I recently installed some system updates, but I'd be surprised if these updates changed shortcuts. At the moment I have no clue why this is happening, so any help will be greatly appreciated.

Note: This only happens on terminals. If I am on some other app, Ctrl+a+d does not trigger any exit commands.


If you type Ctrl+D on an empty line you're signaling End-Of-File (EOF) for that particular shell instance. When the shell gets an EOF it will terminate and the terminal window will close. If you push those keys simultaneously it will in practice be the same as either Ctrl+A and then Ctrl+D or the other way around.

Ctrl-D is a convenient way to exit a shell/terminal window, logout from a remote login session or signal the end of input if you're running a program that accepts input when you run it.

  • This is an enlightening explanation of how Ctrl+D works, but I think it does not answer the question. The problem is that OP's terminal behavior changed. – rozcietrzewiacz Oct 6 '11 at 11:19
  • 2
    This answer is likely correct. It is unlikely the behavior actually changed at any point, because this is the default behavior for terminals and shells. Now, if the shell is exiting when there is still text on the command line (not including the prompt), that would be unusual: when there is text to the right of the cursor, Control-D performs a "forward delete", but if there is no more text—and the cursor is at the start of the command line—then it will produce an EOF. Auto-repeat can make it possible to do this unintentionally if you press the keys a little too long. – Chris Page Oct 6 '11 at 17:34

Bash has a builtin variable named IGNOREEOF which can prevent the shell from closing from an unintended Ctrl+D. See: How can I keep control+d from disconnecting my session?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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