W
W
waltaki2019-07-21 16:38:17
linux
waltaki, 2019-07-21 16:38:17

Top how to get output in bytes?

Hello.
There is a command:

top -b -n 1 -u testUser

top - 09:36:54 up 147 days, 16:19,  2 users,  load average: 0.78, 0.62, 0.66
Tasks:  52 total,   1 running,  51 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.3 us,  1.4 sy,  0.0 ni, 90.1 id,  0.1 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   8388608 total,  3439160 used,  4949448 free,        0 buffers
KiB Swap: 16777216 total,   222388 used, 16554828 free.   692788 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
23150 testUser 20   0 5693308 1.036g  16888 S   6.6 12.9   4:33.26 java

As you can see, RES is being converted. And I need it to be always in bytes.
I tried -E {k/m}, -e {k/m} - didn't help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2019-07-21
@waltaki

cat /proc/$PID/status | grep VmRSS | awk '{print $2 * 1024}'

A
alfss, 2019-07-21
@alfss

Use PS?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question