How to format automatically top output for logging?To configure script to send email only when diff command gives a differenceThe shell command “top” shows which processes from the /proc directory?Redirect script output to /dev/tty1 and also capture output to fileHow is the “load average” interpreted in “top” output? Is it the same for all distributions?If condition not working in script over sshIF-ELSE - Y|N response does not work as requiredWriting CPU Temperature to Port 0x80 Bios Debug Card with Bash ScriptHow to extract an output from JSON to a shellscript variable?Not able to exit from interactive mode for yarn top commandTail with case statement is not working properly

Term for the "extreme-extension" version of a straw man fallacy?

when is out of tune ok?

Is `x >> pure y` equivalent to `liftM (const y) x`

Customer Requests (Sometimes) Drive Me Bonkers!

Balance Issues for a Custom Sorcerer Variant

How do I go from 300 unfinished/half written blog posts, to published posts?

Integer addition + constant, is it a group?

Is this version of a gravity generator feasible?

How to draw lines on a tikz-cd diagram

Applicability of Single Responsibility Principle

How does the UK government determine the size of a mandate?

Class Action - which options I have?

How to write papers efficiently when English isn't my first language?

How to be diplomatic in refusing to write code that breaches the privacy of our users

Closest Prime Number

Method to test if a number is a perfect power?

What is the opposite of 'gravitas'?

How can we prove that any integral in the set of non-elementary integrals cannot be expressed in the form of elementary functions?

Large drywall patch supports

Why not increase contact surface when reentering the atmosphere?

Is there a good way to store credentials outside of a password manager?

You cannot touch me, but I can touch you, who am I?

What can we do to stop prior company from asking us questions?

Opposite of a diet



How to format automatically top output for logging?


To configure script to send email only when diff command gives a differenceThe shell command “top” shows which processes from the /proc directory?Redirect script output to /dev/tty1 and also capture output to fileHow is the “load average” interpreted in “top” output? Is it the same for all distributions?If condition not working in script over sshIF-ELSE - Y|N response does not work as requiredWriting CPU Temperature to Port 0x80 Bios Debug Card with Bash ScriptHow to extract an output from JSON to a shellscript variable?Not able to exit from interactive mode for yarn top commandTail with case statement is not working properly













0















Currently my top command output is shown as:



14861 root 20 0 0.252t 0.028t 556 S 13.3 92.8 8:45.64


I want the display of this in m. It is presently showing in t. I am getting the above output with the below command:



top -b -p 14861 -n1 |tail -1


Is there any option to achieve the same. I will be writing this top output to a log using for loop. So I will not be able to do anything manually.



I even tried with small letter e, that doesn't convert for some of the processes.










share|improve this question




























    0















    Currently my top command output is shown as:



    14861 root 20 0 0.252t 0.028t 556 S 13.3 92.8 8:45.64


    I want the display of this in m. It is presently showing in t. I am getting the above output with the below command:



    top -b -p 14861 -n1 |tail -1


    Is there any option to achieve the same. I will be writing this top output to a log using for loop. So I will not be able to do anything manually.



    I even tried with small letter e, that doesn't convert for some of the processes.










    share|improve this question


























      0












      0








      0


      0






      Currently my top command output is shown as:



      14861 root 20 0 0.252t 0.028t 556 S 13.3 92.8 8:45.64


      I want the display of this in m. It is presently showing in t. I am getting the above output with the below command:



      top -b -p 14861 -n1 |tail -1


      Is there any option to achieve the same. I will be writing this top output to a log using for loop. So I will not be able to do anything manually.



      I even tried with small letter e, that doesn't convert for some of the processes.










      share|improve this question
















      Currently my top command output is shown as:



      14861 root 20 0 0.252t 0.028t 556 S 13.3 92.8 8:45.64


      I want the display of this in m. It is presently showing in t. I am getting the above output with the below command:



      top -b -p 14861 -n1 |tail -1


      Is there any option to achieve the same. I will be writing this top output to a log using for loop. So I will not be able to do anything manually.



      I even tried with small letter e, that doesn't convert for some of the processes.







      linux top






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      Paradox

      209214




      209214










      asked Mar 15 at 6:53









      ProgrammerProgrammer

      389




      389




















          1 Answer
          1






          active

          oldest

          votes


















          1














          You can use command like this:



          top -b -p 14861 -n1 |tail -1|awk '$5=$5*1024*1024; $6=$6*1024*1024 1'





          share|improve this answer























          • thanks but need to manipulate the output itself right, no direct option available in top command itself?

            – Programmer
            Mar 15 at 7:57






          • 1





            @Programmer, not sure it is possible in batch mode. Can be modified only in visual mode

            – Romeo Ninov
            Mar 15 at 7:59










          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%2f506415%2fhow-to-format-automatically-top-output-for-logging%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You can use command like this:



          top -b -p 14861 -n1 |tail -1|awk '$5=$5*1024*1024; $6=$6*1024*1024 1'





          share|improve this answer























          • thanks but need to manipulate the output itself right, no direct option available in top command itself?

            – Programmer
            Mar 15 at 7:57






          • 1





            @Programmer, not sure it is possible in batch mode. Can be modified only in visual mode

            – Romeo Ninov
            Mar 15 at 7:59















          1














          You can use command like this:



          top -b -p 14861 -n1 |tail -1|awk '$5=$5*1024*1024; $6=$6*1024*1024 1'





          share|improve this answer























          • thanks but need to manipulate the output itself right, no direct option available in top command itself?

            – Programmer
            Mar 15 at 7:57






          • 1





            @Programmer, not sure it is possible in batch mode. Can be modified only in visual mode

            – Romeo Ninov
            Mar 15 at 7:59













          1












          1








          1







          You can use command like this:



          top -b -p 14861 -n1 |tail -1|awk '$5=$5*1024*1024; $6=$6*1024*1024 1'





          share|improve this answer













          You can use command like this:



          top -b -p 14861 -n1 |tail -1|awk '$5=$5*1024*1024; $6=$6*1024*1024 1'






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 15 at 7:55









          Romeo NinovRomeo Ninov

          6,86432129




          6,86432129












          • thanks but need to manipulate the output itself right, no direct option available in top command itself?

            – Programmer
            Mar 15 at 7:57






          • 1





            @Programmer, not sure it is possible in batch mode. Can be modified only in visual mode

            – Romeo Ninov
            Mar 15 at 7:59

















          • thanks but need to manipulate the output itself right, no direct option available in top command itself?

            – Programmer
            Mar 15 at 7:57






          • 1





            @Programmer, not sure it is possible in batch mode. Can be modified only in visual mode

            – Romeo Ninov
            Mar 15 at 7:59
















          thanks but need to manipulate the output itself right, no direct option available in top command itself?

          – Programmer
          Mar 15 at 7:57





          thanks but need to manipulate the output itself right, no direct option available in top command itself?

          – Programmer
          Mar 15 at 7:57




          1




          1





          @Programmer, not sure it is possible in batch mode. Can be modified only in visual mode

          – Romeo Ninov
          Mar 15 at 7:59





          @Programmer, not sure it is possible in batch mode. Can be modified only in visual mode

          – Romeo Ninov
          Mar 15 at 7:59

















          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%2f506415%2fhow-to-format-automatically-top-output-for-logging%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