top / htop; group process by command

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











up vote
15
down vote

favorite
2












I'd like to know how much resource a specific command is using.



top and htop displays information on per process basis but I'd like the information to be shown on per command basis. E.g. I'd like to know how much RAM chrome is using.










share|improve this question



















  • 5




    Utilities such as top and ps vary by OS. You should tag the question with the OS you are using.
    – jordanm
    Nov 7 '12 at 22:17










  • @jordanm thanks, I'm using Linux
    – brillout
    Nov 8 '12 at 0:26














up vote
15
down vote

favorite
2












I'd like to know how much resource a specific command is using.



top and htop displays information on per process basis but I'd like the information to be shown on per command basis. E.g. I'd like to know how much RAM chrome is using.










share|improve this question



















  • 5




    Utilities such as top and ps vary by OS. You should tag the question with the OS you are using.
    – jordanm
    Nov 7 '12 at 22:17










  • @jordanm thanks, I'm using Linux
    – brillout
    Nov 8 '12 at 0:26












up vote
15
down vote

favorite
2









up vote
15
down vote

favorite
2






2





I'd like to know how much resource a specific command is using.



top and htop displays information on per process basis but I'd like the information to be shown on per command basis. E.g. I'd like to know how much RAM chrome is using.










share|improve this question















I'd like to know how much resource a specific command is using.



top and htop displays information on per process basis but I'd like the information to be shown on per command basis. E.g. I'd like to know how much RAM chrome is using.







linux top xubuntu htop






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 '12 at 22:25

























asked Nov 7 '12 at 22:13









brillout

17615




17615







  • 5




    Utilities such as top and ps vary by OS. You should tag the question with the OS you are using.
    – jordanm
    Nov 7 '12 at 22:17










  • @jordanm thanks, I'm using Linux
    – brillout
    Nov 8 '12 at 0:26












  • 5




    Utilities such as top and ps vary by OS. You should tag the question with the OS you are using.
    – jordanm
    Nov 7 '12 at 22:17










  • @jordanm thanks, I'm using Linux
    – brillout
    Nov 8 '12 at 0:26







5




5




Utilities such as top and ps vary by OS. You should tag the question with the OS you are using.
– jordanm
Nov 7 '12 at 22:17




Utilities such as top and ps vary by OS. You should tag the question with the OS you are using.
– jordanm
Nov 7 '12 at 22:17












@jordanm thanks, I'm using Linux
– brillout
Nov 8 '12 at 0:26




@jordanm thanks, I'm using Linux
– brillout
Nov 8 '12 at 0:26










3 Answers
3






active

oldest

votes

















up vote
7
down vote













You could run top in batch mode -b with 1 iteration -n1. You grep it, pipe it to awk, SUM the result and print it.



top -b -n1 | grep chrome | awk ' SUM += $9 END print SUM '


I don't know which column you want to output. Change $9 to fit your needs.






share|improve this answer





























    up vote
    2
    down vote













    This is possible in atop. Just press p when running it. From the help:



    Accumulated figures:
    'u' - total resource consumption per user
    'p' - total resource consumption per program (i.e. same process name)
    'j' - total resource consumption per container





    share|improve this answer





























      up vote
      0
      down vote













      Pressing H in htop group the processes by the main thread (command), actually it toggles the threads visibility.






      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%2f55148%2ftop-htop-group-process-by-command%23new-answer', 'question_page');

        );

        Post as a guest






























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        7
        down vote













        You could run top in batch mode -b with 1 iteration -n1. You grep it, pipe it to awk, SUM the result and print it.



        top -b -n1 | grep chrome | awk ' SUM += $9 END print SUM '


        I don't know which column you want to output. Change $9 to fit your needs.






        share|improve this answer


























          up vote
          7
          down vote













          You could run top in batch mode -b with 1 iteration -n1. You grep it, pipe it to awk, SUM the result and print it.



          top -b -n1 | grep chrome | awk ' SUM += $9 END print SUM '


          I don't know which column you want to output. Change $9 to fit your needs.






          share|improve this answer
























            up vote
            7
            down vote










            up vote
            7
            down vote









            You could run top in batch mode -b with 1 iteration -n1. You grep it, pipe it to awk, SUM the result and print it.



            top -b -n1 | grep chrome | awk ' SUM += $9 END print SUM '


            I don't know which column you want to output. Change $9 to fit your needs.






            share|improve this answer














            You could run top in batch mode -b with 1 iteration -n1. You grep it, pipe it to awk, SUM the result and print it.



            top -b -n1 | grep chrome | awk ' SUM += $9 END print SUM '


            I don't know which column you want to output. Change $9 to fit your needs.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 8 '12 at 7:55

























            answered Nov 8 '12 at 7:45









            ThomasFrederiksen

            74143




            74143






















                up vote
                2
                down vote













                This is possible in atop. Just press p when running it. From the help:



                Accumulated figures:
                'u' - total resource consumption per user
                'p' - total resource consumption per program (i.e. same process name)
                'j' - total resource consumption per container





                share|improve this answer


























                  up vote
                  2
                  down vote













                  This is possible in atop. Just press p when running it. From the help:



                  Accumulated figures:
                  'u' - total resource consumption per user
                  'p' - total resource consumption per program (i.e. same process name)
                  'j' - total resource consumption per container





                  share|improve this answer
























                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    This is possible in atop. Just press p when running it. From the help:



                    Accumulated figures:
                    'u' - total resource consumption per user
                    'p' - total resource consumption per program (i.e. same process name)
                    'j' - total resource consumption per container





                    share|improve this answer














                    This is possible in atop. Just press p when running it. From the help:



                    Accumulated figures:
                    'u' - total resource consumption per user
                    'p' - total resource consumption per program (i.e. same process name)
                    'j' - total resource consumption per container






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited May 4 at 11:46

























                    answered May 4 at 11:36









                    Nemo

                    16516




                    16516




















                        up vote
                        0
                        down vote













                        Pressing H in htop group the processes by the main thread (command), actually it toggles the threads visibility.






                        share|improve this answer
























                          up vote
                          0
                          down vote













                          Pressing H in htop group the processes by the main thread (command), actually it toggles the threads visibility.






                          share|improve this answer






















                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            Pressing H in htop group the processes by the main thread (command), actually it toggles the threads visibility.






                            share|improve this answer












                            Pressing H in htop group the processes by the main thread (command), actually it toggles the threads visibility.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Sep 27 at 20:03









                            BG Adrian

                            1011




                            1011



























                                 

                                draft saved


                                draft discarded















































                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f55148%2ftop-htop-group-process-by-command%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?

                                Bahrain

                                Postfix configuration issue with fips on centos 7; mailgun relay