How to find out total memory resource usage with ps?

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












6















With ps command I can find out how much memory each program uses:



ps -u mertnuhoglu -o pcpu,rss,pid,command


Is it possible to find out the sums of each type of resource usage as well, easily?










share|improve this question



















  • 1





    Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).

    – Gilles
    Oct 1 '11 at 22:05















6















With ps command I can find out how much memory each program uses:



ps -u mertnuhoglu -o pcpu,rss,pid,command


Is it possible to find out the sums of each type of resource usage as well, easily?










share|improve this question



















  • 1





    Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).

    – Gilles
    Oct 1 '11 at 22:05













6












6








6








With ps command I can find out how much memory each program uses:



ps -u mertnuhoglu -o pcpu,rss,pid,command


Is it possible to find out the sums of each type of resource usage as well, easily?










share|improve this question
















With ps command I can find out how much memory each program uses:



ps -u mertnuhoglu -o pcpu,rss,pid,command


Is it possible to find out the sums of each type of resource usage as well, easily?







memory ps






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 1 '11 at 22:22









Stéphane Gimenez

19.5k25074




19.5k25074










asked Oct 1 '11 at 9:33









Mert NuhogluMert Nuhoglu

2762410




2762410







  • 1





    Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).

    – Gilles
    Oct 1 '11 at 22:05












  • 1





    Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).

    – Gilles
    Oct 1 '11 at 22:05







1




1





Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).

– Gilles
Oct 1 '11 at 22:05





Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).

– Gilles
Oct 1 '11 at 22:05










2 Answers
2






active

oldest

votes


















9














You could sum the usage columns with awk:



ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'


You might also be interested in the free command for memory usage:



$ free
total used free shared buffers cached
Mem: 2055480 1806596 248884 0 14016 346276
-/+ buffers/cache: 1446304 609176
Swap: 2097148 132980 1964168


The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).






share|improve this answer
































    -2














    You can try:



    $ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i' 





    share|improve this answer




















    • 2





      Do not only paste command. please also mansion/explain how this command use to solve this question.

      – Tejas
      Dec 18 '14 at 9:54










    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%2f21836%2fhow-to-find-out-total-memory-resource-usage-with-ps%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









    9














    You could sum the usage columns with awk:



    ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'


    You might also be interested in the free command for memory usage:



    $ free
    total used free shared buffers cached
    Mem: 2055480 1806596 248884 0 14016 346276
    -/+ buffers/cache: 1446304 609176
    Swap: 2097148 132980 1964168


    The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).






    share|improve this answer





























      9














      You could sum the usage columns with awk:



      ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'


      You might also be interested in the free command for memory usage:



      $ free
      total used free shared buffers cached
      Mem: 2055480 1806596 248884 0 14016 346276
      -/+ buffers/cache: 1446304 609176
      Swap: 2097148 132980 1964168


      The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).






      share|improve this answer



























        9












        9








        9







        You could sum the usage columns with awk:



        ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'


        You might also be interested in the free command for memory usage:



        $ free
        total used free shared buffers cached
        Mem: 2055480 1806596 248884 0 14016 346276
        -/+ buffers/cache: 1446304 609176
        Swap: 2097148 132980 1964168


        The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).






        share|improve this answer















        You could sum the usage columns with awk:



        ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'


        You might also be interested in the free command for memory usage:



        $ free
        total used free shared buffers cached
        Mem: 2055480 1806596 248884 0 14016 346276
        -/+ buffers/cache: 1446304 609176
        Swap: 2097148 132980 1964168


        The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 16 at 13:05









        Community

        1




        1










        answered Oct 1 '11 at 20:36









        Doctor JDoctor J

        38137




        38137























            -2














            You can try:



            $ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i' 





            share|improve this answer




















            • 2





              Do not only paste command. please also mansion/explain how this command use to solve this question.

              – Tejas
              Dec 18 '14 at 9:54















            -2














            You can try:



            $ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i' 





            share|improve this answer




















            • 2





              Do not only paste command. please also mansion/explain how this command use to solve this question.

              – Tejas
              Dec 18 '14 at 9:54













            -2












            -2








            -2







            You can try:



            $ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i' 





            share|improve this answer















            You can try:



            $ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i' 






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 18 '14 at 10:09









            a CVn

            17.3k851106




            17.3k851106










            answered Dec 18 '14 at 9:48









            Daniel LerchDaniel Lerch

            1091




            1091







            • 2





              Do not only paste command. please also mansion/explain how this command use to solve this question.

              – Tejas
              Dec 18 '14 at 9:54












            • 2





              Do not only paste command. please also mansion/explain how this command use to solve this question.

              – Tejas
              Dec 18 '14 at 9:54







            2




            2





            Do not only paste command. please also mansion/explain how this command use to solve this question.

            – Tejas
            Dec 18 '14 at 9:54





            Do not only paste command. please also mansion/explain how this command use to solve this question.

            – Tejas
            Dec 18 '14 at 9:54

















            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f21836%2fhow-to-find-out-total-memory-resource-usage-with-ps%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

            Peggy Mitchell

            Palaiologos

            The Forum (Inglewood, California)