Search for processes which are CPU consumming

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











up vote
1
down vote

favorite












I can track the process launched by the user4 with awk:



ps aux | awk '$1~/user4/'


And also to track what process consume more than 10% CPU:



ps aux | awk '$3> 10'


How can I combine both with awk, aka search for process launched by user4 which are consumming more than 10% CPU?










share|improve this question



























    up vote
    1
    down vote

    favorite












    I can track the process launched by the user4 with awk:



    ps aux | awk '$1~/user4/'


    And also to track what process consume more than 10% CPU:



    ps aux | awk '$3> 10'


    How can I combine both with awk, aka search for process launched by user4 which are consumming more than 10% CPU?










    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I can track the process launched by the user4 with awk:



      ps aux | awk '$1~/user4/'


      And also to track what process consume more than 10% CPU:



      ps aux | awk '$3> 10'


      How can I combine both with awk, aka search for process launched by user4 which are consumming more than 10% CPU?










      share|improve this question















      I can track the process launched by the user4 with awk:



      ps aux | awk '$1~/user4/'


      And also to track what process consume more than 10% CPU:



      ps aux | awk '$3> 10'


      How can I combine both with awk, aka search for process launched by user4 which are consumming more than 10% CPU?







      command-line awk ps






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 21 at 8:17









      Rui F Ribeiro

      36.7k1271116




      36.7k1271116










      asked Mar 22 '16 at 9:08









      Colonel Beauvel

      1163




      1163




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          Ok ... I found it reading more awk documentation, sorry for disturbing:



          ps aux | awk '$1~/user4/ && $3> 0'





          share|improve this answer
















          • 1




            since ~ is pattern-matching, be careful if you ever end up with a "user44" or "ruser4"
            – Jeff Schaller
            Mar 22 '16 at 11:01










          • this is completely true! I went for '$1~/user4$/ && $3> 0' to avoid this
            – Colonel Beauvel
            Mar 22 '16 at 11:22






          • 1




            Consider == as well
            – Jeff Schaller
            Mar 22 '16 at 11:31

















          up vote
          1
          down vote













          or as an alternative



          ps -u user4 -o pcpu,args | awk '$1>0' 


          see man ps for arguement of -o , some argument might be cputime,etime,args,comm,tty






          share|improve this answer




















          • hum despite I like the idea, the totla command returns nothing on my side, but when I only do ps -u user4 I have the PID, TTY, TIME and CMD.
            – Colonel Beauvel
            Mar 22 '16 at 11:25










          • try adding XPG4= or UNIX95= before ps
            – Archemar
            Mar 22 '16 at 11:53










          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%2f271419%2fsearch-for-processes-which-are-cpu-consumming%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
          1
          down vote













          Ok ... I found it reading more awk documentation, sorry for disturbing:



          ps aux | awk '$1~/user4/ && $3> 0'





          share|improve this answer
















          • 1




            since ~ is pattern-matching, be careful if you ever end up with a "user44" or "ruser4"
            – Jeff Schaller
            Mar 22 '16 at 11:01










          • this is completely true! I went for '$1~/user4$/ && $3> 0' to avoid this
            – Colonel Beauvel
            Mar 22 '16 at 11:22






          • 1




            Consider == as well
            – Jeff Schaller
            Mar 22 '16 at 11:31














          up vote
          1
          down vote













          Ok ... I found it reading more awk documentation, sorry for disturbing:



          ps aux | awk '$1~/user4/ && $3> 0'





          share|improve this answer
















          • 1




            since ~ is pattern-matching, be careful if you ever end up with a "user44" or "ruser4"
            – Jeff Schaller
            Mar 22 '16 at 11:01










          • this is completely true! I went for '$1~/user4$/ && $3> 0' to avoid this
            – Colonel Beauvel
            Mar 22 '16 at 11:22






          • 1




            Consider == as well
            – Jeff Schaller
            Mar 22 '16 at 11:31












          up vote
          1
          down vote










          up vote
          1
          down vote









          Ok ... I found it reading more awk documentation, sorry for disturbing:



          ps aux | awk '$1~/user4/ && $3> 0'





          share|improve this answer












          Ok ... I found it reading more awk documentation, sorry for disturbing:



          ps aux | awk '$1~/user4/ && $3> 0'






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 22 '16 at 9:16









          Colonel Beauvel

          1163




          1163







          • 1




            since ~ is pattern-matching, be careful if you ever end up with a "user44" or "ruser4"
            – Jeff Schaller
            Mar 22 '16 at 11:01










          • this is completely true! I went for '$1~/user4$/ && $3> 0' to avoid this
            – Colonel Beauvel
            Mar 22 '16 at 11:22






          • 1




            Consider == as well
            – Jeff Schaller
            Mar 22 '16 at 11:31












          • 1




            since ~ is pattern-matching, be careful if you ever end up with a "user44" or "ruser4"
            – Jeff Schaller
            Mar 22 '16 at 11:01










          • this is completely true! I went for '$1~/user4$/ && $3> 0' to avoid this
            – Colonel Beauvel
            Mar 22 '16 at 11:22






          • 1




            Consider == as well
            – Jeff Schaller
            Mar 22 '16 at 11:31







          1




          1




          since ~ is pattern-matching, be careful if you ever end up with a "user44" or "ruser4"
          – Jeff Schaller
          Mar 22 '16 at 11:01




          since ~ is pattern-matching, be careful if you ever end up with a "user44" or "ruser4"
          – Jeff Schaller
          Mar 22 '16 at 11:01












          this is completely true! I went for '$1~/user4$/ && $3> 0' to avoid this
          – Colonel Beauvel
          Mar 22 '16 at 11:22




          this is completely true! I went for '$1~/user4$/ && $3> 0' to avoid this
          – Colonel Beauvel
          Mar 22 '16 at 11:22




          1




          1




          Consider == as well
          – Jeff Schaller
          Mar 22 '16 at 11:31




          Consider == as well
          – Jeff Schaller
          Mar 22 '16 at 11:31












          up vote
          1
          down vote













          or as an alternative



          ps -u user4 -o pcpu,args | awk '$1>0' 


          see man ps for arguement of -o , some argument might be cputime,etime,args,comm,tty






          share|improve this answer




















          • hum despite I like the idea, the totla command returns nothing on my side, but when I only do ps -u user4 I have the PID, TTY, TIME and CMD.
            – Colonel Beauvel
            Mar 22 '16 at 11:25










          • try adding XPG4= or UNIX95= before ps
            – Archemar
            Mar 22 '16 at 11:53














          up vote
          1
          down vote













          or as an alternative



          ps -u user4 -o pcpu,args | awk '$1>0' 


          see man ps for arguement of -o , some argument might be cputime,etime,args,comm,tty






          share|improve this answer




















          • hum despite I like the idea, the totla command returns nothing on my side, but when I only do ps -u user4 I have the PID, TTY, TIME and CMD.
            – Colonel Beauvel
            Mar 22 '16 at 11:25










          • try adding XPG4= or UNIX95= before ps
            – Archemar
            Mar 22 '16 at 11:53












          up vote
          1
          down vote










          up vote
          1
          down vote









          or as an alternative



          ps -u user4 -o pcpu,args | awk '$1>0' 


          see man ps for arguement of -o , some argument might be cputime,etime,args,comm,tty






          share|improve this answer












          or as an alternative



          ps -u user4 -o pcpu,args | awk '$1>0' 


          see man ps for arguement of -o , some argument might be cputime,etime,args,comm,tty







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 22 '16 at 10:42









          Archemar

          19.1k93467




          19.1k93467











          • hum despite I like the idea, the totla command returns nothing on my side, but when I only do ps -u user4 I have the PID, TTY, TIME and CMD.
            – Colonel Beauvel
            Mar 22 '16 at 11:25










          • try adding XPG4= or UNIX95= before ps
            – Archemar
            Mar 22 '16 at 11:53
















          • hum despite I like the idea, the totla command returns nothing on my side, but when I only do ps -u user4 I have the PID, TTY, TIME and CMD.
            – Colonel Beauvel
            Mar 22 '16 at 11:25










          • try adding XPG4= or UNIX95= before ps
            – Archemar
            Mar 22 '16 at 11:53















          hum despite I like the idea, the totla command returns nothing on my side, but when I only do ps -u user4 I have the PID, TTY, TIME and CMD.
          – Colonel Beauvel
          Mar 22 '16 at 11:25




          hum despite I like the idea, the totla command returns nothing on my side, but when I only do ps -u user4 I have the PID, TTY, TIME and CMD.
          – Colonel Beauvel
          Mar 22 '16 at 11:25












          try adding XPG4= or UNIX95= before ps
          – Archemar
          Mar 22 '16 at 11:53




          try adding XPG4= or UNIX95= before ps
          – Archemar
          Mar 22 '16 at 11:53

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f271419%2fsearch-for-processes-which-are-cpu-consumming%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?