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.


You can use command like this:

top -b -p 14861 -n1 |tail -1|awk '{$5=$5*1024*1024; $6=$6*1024*1024} 1'
|improve this answer|||||
  • thanks but need to manipulate the output itself right, no direct option available in top command itself? – Programmer Mar 15 '19 at 7:57
  • 1
    @Programmer, not sure it is possible in batch mode. Can be modified only in visual mode – Romeo Ninov Mar 15 '19 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.