Why does pressing Ctrl-backslash result in core dump?

Chiel ten Brinke picture Chiel ten Brinke · Oct 8, 2013 · Viewed 10.9k times · Source

When I'm in a python application (the python shell, for instance), pressing Ctrl\ results in

>>> Quit (core dumped)

Why is this, and how can I avoid this? It is very inconvenient if application bails out whenever I press Ctrl\ by accident.

Answer

Robᵩ picture Robᵩ · Oct 8, 2013

CTRL-\ is the Linux key that generates the QUIT signal. Generally, that signal causes a program to terminate and dump core. This is a feature of UNIX and Linux, wholly unrelated to Python. (For example, try sleep 30 followed by CTRL-\.)

If you want to disable that feature, use the stty command.

From the Linux command line, before Python starts:

stty quit undef