I'm trying to process 'top' output to set CPU performance data. When I just grep the output it is colorized:
or
The numbers are bold, and it adds a lot of unnecessary data to the output:
I tried to strip the color codes answer but it does not work. I want to avoid other much more complex answers in that question for sake of performance.
I've tried to disable colors by switching term mode but no luck:
So how can I disable the color output?
PS: I found how to get data: I can awk only numbers then it works, but still wonder if there is any way to disable color here.
top -b
? – DopeGhoti Dec 05 '17 at 22:49top
output is not really a good idea for monitoring. – Patrick Mevzek Dec 06 '17 at 02:10top
is only a frontend using values in collected from various files in/proc/
and/sys/
. For example see/proc/meminfo
,/proc/loadavg
or/proc/stat
. There are libraries and tools using and parsing that. – Patrick Mevzek Dec 06 '17 at 21:34vmstat
to start. – Patrick Mevzek Dec 06 '17 at 21:45hexdump
does still not need to be an image... – Kusalananda Oct 11 '18 at 12:16