Is it possible to stop output from a command after bg?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












Suppose this situation



wget http://file 


wget starts to download file.



I put it in the background.



^Z
bg


The command goes into the background.



But its output is still on the console also -- if the console is still open.



Is it possible to stop the command's output?



Wget is only an example; think about a command which writes a lot of output.



At the console, I know it is possible to do bg and then close terminal and open another, but what if I have only one terminal avaliable and no pseudo-terminals?







share|improve this question


















  • 1




    See how to change the output redirection of a running process. You can try reptyr.
    – Mark Plotnick
    Oct 15 '17 at 12:29















up vote
3
down vote

favorite












Suppose this situation



wget http://file 


wget starts to download file.



I put it in the background.



^Z
bg


The command goes into the background.



But its output is still on the console also -- if the console is still open.



Is it possible to stop the command's output?



Wget is only an example; think about a command which writes a lot of output.



At the console, I know it is possible to do bg and then close terminal and open another, but what if I have only one terminal avaliable and no pseudo-terminals?







share|improve this question


















  • 1




    See how to change the output redirection of a running process. You can try reptyr.
    – Mark Plotnick
    Oct 15 '17 at 12:29













up vote
3
down vote

favorite









up vote
3
down vote

favorite











Suppose this situation



wget http://file 


wget starts to download file.



I put it in the background.



^Z
bg


The command goes into the background.



But its output is still on the console also -- if the console is still open.



Is it possible to stop the command's output?



Wget is only an example; think about a command which writes a lot of output.



At the console, I know it is possible to do bg and then close terminal and open another, but what if I have only one terminal avaliable and no pseudo-terminals?







share|improve this question














Suppose this situation



wget http://file 


wget starts to download file.



I put it in the background.



^Z
bg


The command goes into the background.



But its output is still on the console also -- if the console is still open.



Is it possible to stop the command's output?



Wget is only an example; think about a command which writes a lot of output.



At the console, I know it is possible to do bg and then close terminal and open another, but what if I have only one terminal avaliable and no pseudo-terminals?









share|improve this question













share|improve this question




share|improve this question








edited Oct 15 '17 at 0:12









Jeff Schaller

32.1k849109




32.1k849109










asked Oct 14 '17 at 16:09









elbarna

3,83693577




3,83693577







  • 1




    See how to change the output redirection of a running process. You can try reptyr.
    – Mark Plotnick
    Oct 15 '17 at 12:29













  • 1




    See how to change the output redirection of a running process. You can try reptyr.
    – Mark Plotnick
    Oct 15 '17 at 12:29








1




1




See how to change the output redirection of a running process. You can try reptyr.
– Mark Plotnick
Oct 15 '17 at 12:29





See how to change the output redirection of a running process. You can try reptyr.
– Mark Plotnick
Oct 15 '17 at 12:29











2 Answers
2






active

oldest

votes

















up vote
0
down vote













Here's a solution that actually redirects the output of a command while it is running: https://superuser.com/questions/732503/redirect-stdout-stderr-of-a-background-job-from-console-to-a-log-file



For a solution that is more usable in an every-day scenario of using a terminal, you could do
wget -o log http://file &
to run wget in the background and write its output to log instead of your terminal. Of course, you won't see any output at all in this case (even if you ran wget in foreground), but you could do tail -f log to look at the output as it grows.






share|improve this answer



























    up vote
    0
    down vote













    Do you mean that you want to keep wget(or some other cmd) running background without outputing messages to the console? If that's the question, you can try redirection




    $ wget http://file > /dev/null

    the cmd above will redirect the stdout to /dev/null and you won't see messages except error messages.
    If you don't want to see error messages either, try this

    $ wget http://file 1>/dev/null 2>&1



    You can google redirection for more detailed information.^_^






    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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      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%2f398127%2fis-it-possible-to-stop-output-from-a-command-after-bg%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      Here's a solution that actually redirects the output of a command while it is running: https://superuser.com/questions/732503/redirect-stdout-stderr-of-a-background-job-from-console-to-a-log-file



      For a solution that is more usable in an every-day scenario of using a terminal, you could do
      wget -o log http://file &
      to run wget in the background and write its output to log instead of your terminal. Of course, you won't see any output at all in this case (even if you ran wget in foreground), but you could do tail -f log to look at the output as it grows.






      share|improve this answer
























        up vote
        0
        down vote













        Here's a solution that actually redirects the output of a command while it is running: https://superuser.com/questions/732503/redirect-stdout-stderr-of-a-background-job-from-console-to-a-log-file



        For a solution that is more usable in an every-day scenario of using a terminal, you could do
        wget -o log http://file &
        to run wget in the background and write its output to log instead of your terminal. Of course, you won't see any output at all in this case (even if you ran wget in foreground), but you could do tail -f log to look at the output as it grows.






        share|improve this answer






















          up vote
          0
          down vote










          up vote
          0
          down vote









          Here's a solution that actually redirects the output of a command while it is running: https://superuser.com/questions/732503/redirect-stdout-stderr-of-a-background-job-from-console-to-a-log-file



          For a solution that is more usable in an every-day scenario of using a terminal, you could do
          wget -o log http://file &
          to run wget in the background and write its output to log instead of your terminal. Of course, you won't see any output at all in this case (even if you ran wget in foreground), but you could do tail -f log to look at the output as it grows.






          share|improve this answer












          Here's a solution that actually redirects the output of a command while it is running: https://superuser.com/questions/732503/redirect-stdout-stderr-of-a-background-job-from-console-to-a-log-file



          For a solution that is more usable in an every-day scenario of using a terminal, you could do
          wget -o log http://file &
          to run wget in the background and write its output to log instead of your terminal. Of course, you won't see any output at all in this case (even if you ran wget in foreground), but you could do tail -f log to look at the output as it grows.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 14 '17 at 17:12









          PawkyPenguin

          696110




          696110






















              up vote
              0
              down vote













              Do you mean that you want to keep wget(or some other cmd) running background without outputing messages to the console? If that's the question, you can try redirection




              $ wget http://file > /dev/null

              the cmd above will redirect the stdout to /dev/null and you won't see messages except error messages.
              If you don't want to see error messages either, try this

              $ wget http://file 1>/dev/null 2>&1



              You can google redirection for more detailed information.^_^






              share|improve this answer
























                up vote
                0
                down vote













                Do you mean that you want to keep wget(or some other cmd) running background without outputing messages to the console? If that's the question, you can try redirection




                $ wget http://file > /dev/null

                the cmd above will redirect the stdout to /dev/null and you won't see messages except error messages.
                If you don't want to see error messages either, try this

                $ wget http://file 1>/dev/null 2>&1



                You can google redirection for more detailed information.^_^






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Do you mean that you want to keep wget(or some other cmd) running background without outputing messages to the console? If that's the question, you can try redirection




                  $ wget http://file > /dev/null

                  the cmd above will redirect the stdout to /dev/null and you won't see messages except error messages.
                  If you don't want to see error messages either, try this

                  $ wget http://file 1>/dev/null 2>&1



                  You can google redirection for more detailed information.^_^






                  share|improve this answer












                  Do you mean that you want to keep wget(or some other cmd) running background without outputing messages to the console? If that's the question, you can try redirection




                  $ wget http://file > /dev/null

                  the cmd above will redirect the stdout to /dev/null and you won't see messages except error messages.
                  If you don't want to see error messages either, try this

                  $ wget http://file 1>/dev/null 2>&1



                  You can google redirection for more detailed information.^_^







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 15 '17 at 5:33









                  Charles

                  1567




                  1567



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398127%2fis-it-possible-to-stop-output-from-a-command-after-bg%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Displaying single band from multi-band raster using QGIS

                      How many registers does an x86_64 CPU actually have?