Getting out of while loop on console Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionHow to write the output of live-f1 into a fileShell console clearingComputer terminal and virtual consoleBash while loop and reading from pipeEndless data loop from dev/ttyUSB while sending AT commandsHow to change keyboard speed in the Linux console?How to open process again?How to find PID of a while loop?Getting console width using a bash scriptexit terminal window

Random body shuffle every night—can we still function?

Which types of prepositional phrase is "toward its employees" in Philosophy guiding the organization's policies towards its employees is not bad?

One-one communication

How do I find my Spellcasting Ability for my D&D character?

malloc in main() or malloc in another function: allocating memory for a struct and its members

Keep at all times, the minus sign above aligned with minus sign below

Table formatting with tabularx?

.bashrc alias for a command with fixed second parameter

Pointing to problems without suggesting solutions

Does a random sequence of vectors span a Hilbert space?

Shimano 105 brifters (5800) and Avid BB5 compatibility

Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?

Can two people see the same photon?

How to achieve cat-like agility?

Is there a verb for listening stealthily?

French equivalents of おしゃれは足元から (Every good outfit starts with the shoes)

IC on Digikey is 5x more expensive than board containing same IC on Alibaba: How?

How to name indistinguishable henchmen in a screenplay?

How do Java 8 default methods hеlp with lambdas?

Dinosaur Word Search, Letter Solve, and Unscramble

Where and when has Thucydides been studied?

How do you write "wild blueberries flavored"?

How does TikZ render an arc?

How could a hydrazine and N2O4 cloud (or it's reactants) show up in weather radar?



Getting out of while loop on console



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionHow to write the output of live-f1 into a fileShell console clearingComputer terminal and virtual consoleBash while loop and reading from pipeEndless data loop from dev/ttyUSB while sending AT commandsHow to change keyboard speed in the Linux console?How to open process again?How to find PID of a while loop?Getting console width using a bash scriptexit terminal window



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I ran a command:



while true ; do ..... ....... ; done


on the Linux console/terminal, and now this while loop is continuously running.



I have two questions here:



  1. How to get out of this while loop?

  2. If my PuTTY session to Linux gets disconnected, how can I go back and find this loop and kill it?









share|improve this question









New contributor




VikasB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    2















    I ran a command:



    while true ; do ..... ....... ; done


    on the Linux console/terminal, and now this while loop is continuously running.



    I have two questions here:



    1. How to get out of this while loop?

    2. If my PuTTY session to Linux gets disconnected, how can I go back and find this loop and kill it?









    share|improve this question









    New contributor




    VikasB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      2












      2








      2








      I ran a command:



      while true ; do ..... ....... ; done


      on the Linux console/terminal, and now this while loop is continuously running.



      I have two questions here:



      1. How to get out of this while loop?

      2. If my PuTTY session to Linux gets disconnected, how can I go back and find this loop and kill it?









      share|improve this question









      New contributor




      VikasB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I ran a command:



      while true ; do ..... ....... ; done


      on the Linux console/terminal, and now this while loop is continuously running.



      I have two questions here:



      1. How to get out of this while loop?

      2. If my PuTTY session to Linux gets disconnected, how can I go back and find this loop and kill it?






      shell command-line terminal






      share|improve this question









      New contributor




      VikasB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      VikasB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited yesterday









      G-Man

      13.9k93870




      13.9k93870






      New contributor




      VikasB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked yesterday









      VikasBVikasB

      111




      111




      New contributor




      VikasB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      VikasB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      VikasB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          2 Answers
          2






          active

          oldest

          votes


















          3














          You can cancel the loop with: CTRL + C



          Your session would have ended when your putty session closed so the loop will no longer be running



          • unless it was running in a screen session or similar in which case you would have to reattach it using the method of that particular program.





          share|improve this answer
































            0














            Sometimes hitting control-c doesn't work: the loop body gets the control-c and the loop keeps iterating. (Although I can't reproduce this behaviour right now with sleep 1 as the loop condition or the body, I remember seeing it.)



            control-z can stop this, and the loop won't resume after fg unless the loop was inside a subshell like (while true;do : ;done). (With bash on GNU/Linux).



            Or control-z / fg is useful if you want the currently-running iteration of the loop to finish cleanly, but not start another iteration.



            (Control-z stops a job, getting the kernel to deliver SIGTSTP exactly like how control-c delivers SIGINT, on a TTY that's not in raw mode. The default action for this signal is to stop the job. fg and bg are job-control commands, see the bash built-in "help" for them and the jobs command.)






            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
              );



              );






              VikasB is a new contributor. Be nice, and check out our Code of Conduct.









              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513588%2fgetting-out-of-while-loop-on-console%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              You can cancel the loop with: CTRL + C



              Your session would have ended when your putty session closed so the loop will no longer be running



              • unless it was running in a screen session or similar in which case you would have to reattach it using the method of that particular program.





              share|improve this answer





























                3














                You can cancel the loop with: CTRL + C



                Your session would have ended when your putty session closed so the loop will no longer be running



                • unless it was running in a screen session or similar in which case you would have to reattach it using the method of that particular program.





                share|improve this answer



























                  3












                  3








                  3







                  You can cancel the loop with: CTRL + C



                  Your session would have ended when your putty session closed so the loop will no longer be running



                  • unless it was running in a screen session or similar in which case you would have to reattach it using the method of that particular program.





                  share|improve this answer















                  You can cancel the loop with: CTRL + C



                  Your session would have ended when your putty session closed so the loop will no longer be running



                  • unless it was running in a screen session or similar in which case you would have to reattach it using the method of that particular program.






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited yesterday









                  terdon

                  134k33270450




                  134k33270450










                  answered yesterday









                  Jesse_bJesse_b

                  14.5k33574




                  14.5k33574























                      0














                      Sometimes hitting control-c doesn't work: the loop body gets the control-c and the loop keeps iterating. (Although I can't reproduce this behaviour right now with sleep 1 as the loop condition or the body, I remember seeing it.)



                      control-z can stop this, and the loop won't resume after fg unless the loop was inside a subshell like (while true;do : ;done). (With bash on GNU/Linux).



                      Or control-z / fg is useful if you want the currently-running iteration of the loop to finish cleanly, but not start another iteration.



                      (Control-z stops a job, getting the kernel to deliver SIGTSTP exactly like how control-c delivers SIGINT, on a TTY that's not in raw mode. The default action for this signal is to stop the job. fg and bg are job-control commands, see the bash built-in "help" for them and the jobs command.)






                      share|improve this answer



























                        0














                        Sometimes hitting control-c doesn't work: the loop body gets the control-c and the loop keeps iterating. (Although I can't reproduce this behaviour right now with sleep 1 as the loop condition or the body, I remember seeing it.)



                        control-z can stop this, and the loop won't resume after fg unless the loop was inside a subshell like (while true;do : ;done). (With bash on GNU/Linux).



                        Or control-z / fg is useful if you want the currently-running iteration of the loop to finish cleanly, but not start another iteration.



                        (Control-z stops a job, getting the kernel to deliver SIGTSTP exactly like how control-c delivers SIGINT, on a TTY that's not in raw mode. The default action for this signal is to stop the job. fg and bg are job-control commands, see the bash built-in "help" for them and the jobs command.)






                        share|improve this answer

























                          0












                          0








                          0







                          Sometimes hitting control-c doesn't work: the loop body gets the control-c and the loop keeps iterating. (Although I can't reproduce this behaviour right now with sleep 1 as the loop condition or the body, I remember seeing it.)



                          control-z can stop this, and the loop won't resume after fg unless the loop was inside a subshell like (while true;do : ;done). (With bash on GNU/Linux).



                          Or control-z / fg is useful if you want the currently-running iteration of the loop to finish cleanly, but not start another iteration.



                          (Control-z stops a job, getting the kernel to deliver SIGTSTP exactly like how control-c delivers SIGINT, on a TTY that's not in raw mode. The default action for this signal is to stop the job. fg and bg are job-control commands, see the bash built-in "help" for them and the jobs command.)






                          share|improve this answer













                          Sometimes hitting control-c doesn't work: the loop body gets the control-c and the loop keeps iterating. (Although I can't reproduce this behaviour right now with sleep 1 as the loop condition or the body, I remember seeing it.)



                          control-z can stop this, and the loop won't resume after fg unless the loop was inside a subshell like (while true;do : ;done). (With bash on GNU/Linux).



                          Or control-z / fg is useful if you want the currently-running iteration of the loop to finish cleanly, but not start another iteration.



                          (Control-z stops a job, getting the kernel to deliver SIGTSTP exactly like how control-c delivers SIGINT, on a TTY that's not in raw mode. The default action for this signal is to stop the job. fg and bg are job-control commands, see the bash built-in "help" for them and the jobs command.)







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered yesterday









                          Peter CordesPeter Cordes

                          4,5731434




                          4,5731434




















                              VikasB is a new contributor. Be nice, and check out our Code of Conduct.









                              draft saved

                              draft discarded


















                              VikasB is a new contributor. Be nice, and check out our Code of Conduct.












                              VikasB is a new contributor. Be nice, and check out our Code of Conduct.











                              VikasB is a new contributor. Be nice, and check out our Code of Conduct.














                              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.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513588%2fgetting-out-of-while-loop-on-console%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

                              Личност Атрибути на личността | Литература и източници | НавигацияРаждането на личносттаредактиратередактирате

                              Are there any AGPL-style licences that require source code modifications to be public? Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Force derivative works to be publicAre there any GPL like licenses for Apple App Store?Do you violate the GPL if you provide source code that cannot be compiled?GPL - is it distribution to use libraries in an appliance loaned to customers?Distributing App for free which uses GPL'ed codeModifications of server software under GPL, with web/CLI interfaceDoes using an AGPLv3-licensed library prevent me from dual-licensing my own source code?Can I publish only select code under GPLv3 from a private project?Is there published precedent regarding the scope of covered work that uses AGPL software?If MIT licensed code links to GPL licensed code what should be the license of the resulting binary program?If I use a public API endpoint that has its source code licensed under AGPL in my app, do I need to disclose my source?

                              How does Billy Russo acquire his 'Jigsaw' mask? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why does Bane wear the mask?Why does Kylo Ren wear a mask?Why did Captain America remove his mask while fighting Batroc the Leaper?How did the OA acquire her wisdom?Is Billy Breckenridge gay?How does Adrian Toomes hide his earnings from the IRS?What is the state of affairs on Nootka Sound by the end of season 1?How did Tia Dalma acquire Captain Barbossa's body?How is one “Deemed Worthy”, to acquire the Greatsword “Dawn”?How did Karen acquire the handgun?