How to kill a process in a terminal inside emacs












7














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?










share|improve this question


















  • 1




    Ctrl-G often works inside an emacs buffer.
    – Faheem Mitha
    Mar 14 '14 at 19:59






  • 9




    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
















7














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?










share|improve this question


















  • 1




    Ctrl-G often works inside an emacs buffer.
    – Faheem Mitha
    Mar 14 '14 at 19:59






  • 9




    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














7












7








7


1





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?










share|improve this question













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?







emacs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 14 '14 at 19:18









user2290347

16617




16617








  • 1




    Ctrl-G often works inside an emacs buffer.
    – Faheem Mitha
    Mar 14 '14 at 19:59






  • 9




    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














  • 1




    Ctrl-G often works inside an emacs buffer.
    – Faheem Mitha
    Mar 14 '14 at 19:59






  • 9




    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








1




1




Ctrl-G often works inside an emacs buffer.
– Faheem Mitha
Mar 14 '14 at 19:59




Ctrl-G often works inside an emacs buffer.
– Faheem Mitha
Mar 14 '14 at 19:59




9




9




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




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










3 Answers
3






active

oldest

votes


















13














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






share|improve this answer































    1














    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






    share|improve this answer























    • 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 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 at 4:39



















    -1














    Use the key sequence C-c C-k.






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f119737%2fhow-to-kill-a-process-in-a-terminal-inside-emacs%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      13














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






      share|improve this answer




























        13














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






        share|improve this answer


























          13












          13








          13






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






          share|improve this answer














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







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 13 '17 at 12:36









          Community

          1




          1










          answered Mar 16 '14 at 12:44









          user2290347

          16617




          16617

























              1














              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






              share|improve this answer























              • 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 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 at 4:39
















              1














              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






              share|improve this answer























              • 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 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 at 4:39














              1












              1








              1






              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






              share|improve this answer














              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







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Dec 13 at 3:32

























              answered Apr 20 '14 at 7:09









              Yongqiang Zhou

              3925




              3925












              • 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 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 at 4:39


















              • 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 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 at 4:39
















              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 at 9:40




              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 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 at 4:39




              @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 at 4:39











              -1














              Use the key sequence C-c C-k.






              share|improve this answer




























                -1














                Use the key sequence C-c C-k.






                share|improve this answer


























                  -1












                  -1








                  -1






                  Use the key sequence C-c C-k.






                  share|improve this answer














                  Use the key sequence C-c C-k.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Apr 27 at 7:58









                  user90255

                  1




                  1










                  answered Apr 27 at 3:40









                  Stanley Yang

                  1




                  1






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f119737%2fhow-to-kill-a-process-in-a-terminal-inside-emacs%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      List directoties down one level, excluding some named directories and files

                      list processes belonging to a network namespace

                      list systemd RuntimeDirectory mounts