0

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?

karel
  • 5,489
  • 46
  • 45
  • 50
mko
  • 21,334
  • 49
  • 130
  • 191

0 Answers0