Wednesday, September 29, 2010

Linux Top Command Output

Top command on Linux displays the statistics of the CPU usage, memory usage.

This output is volatile and keeps changing frequently.

To Capture this output in a text file often the command top - n 1 > topoutputfile.txt
does not produce desired results.

To elaborate more there are lot of junk characters with the output.
To get a clean output for the top command in a file which can be parsed later on is top -n 1 - b > topoutputfile.txt

-n -- Number of iterations or frames top must producing before giving the output.
-b -- Batch Mode, provides good readable output.

No comments:

Post a Comment