How can I grep easily the value of %MEM only from TOP of specific user (e.g tomcat) on console:
top -u tomcat | grep ????
expected output:
0.1
How can I grep easily the value of %MEM only from TOP of specific user (e.g tomcat) on console:
top -u tomcat | grep ????
expected output:
0.1
Copyright © 2021 Jogjafile Inc.

This just shows the %MEM values:
This runs
topwith -b (batch / background / script mode), only once (-n 1), for user tomcat, order by memory. Pass that information toawkto discard all before %MEM (handled by the p=0 -> 1 change).This produces a list like:
If you just wish the top value, add this after the
awk:If you wish to total it, change
awkto: