When I code, I usually use multiple buffers in emacs. Some buffers with my code, and a buffer with a terminal emulator (M-x term), There I compile, execute interpreters, etc.

When I get an infinite loop in some computation, I cannot kill my process (As one could do with a normal terminal with Ctrl-C), since obviously the terminal embedded in emacs doesn't get the interrupt.

Is there a way to do this?

  • 1
    Ctrl-G often works inside an emacs buffer. – Faheem Mitha Mar 14 '14 at 19:59
  • 10
    For me, Ctrl-C Ctrl-C sends a ^C to the terminal and I'm able to interrupt a running program. – ALiX Mar 14 '14 at 20:18

As mentioned in the comments, by @ALiX using Ctrl+C+ Ctrl+C (2 times) worked.


If you run a process in eshell,you can use ctrl c ctrl c to kill the process, otherwise you can kill the buffer using ctrl x k

  • Using GNU Emacs 25.2.2 in Terminator. Ctrl-C+Ctrl-C didn't work, but Ctrl-x k (which calls kill-buffer) did. But, you lose the buffer... – AAAfarmclub Dec 6 '18 at 9:40
  • @AAAfarmclub if you're using ansi-term instead of term, then you should use C-x C-c (no, that won't exit your emacs) – pizdelect Dec 13 '18 at 4:39

Use the key sequence C-c C-k.

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.