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 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.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

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.

share|improve this answer
    
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
1  
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
add comment

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?

share|improve this answer
add comment

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.