I want to do a little experiment that converts the output of top
to a json file over http and then feeds it to a data visualization tool like D3.js.
I could do something like:
top | awk '/Mem/ {print "cpu used: " $2}'
and get:
cpu used: 22M
but I have to execute the above command repeatedly to get a data over time.
Is there a way to run top without stopping it, and get a stream of data instead of repeatedly executing it?