I am interested at using the output of Top command which shows some important system paramter related to CPU usage. I want to write a shell script in order to manipulate this output of command and to take some statistics for CPU.
Basically, I tried to redirect the top output to a textfile in this way:
Top > test
Except the fact the this action lasted too much, the content of filled new file was misformatted, where rows where mixed with eachother.
I have tried the same thing on a SUSE Linux machine and it worked.
I dont know why here it doesnt work in order to have a formatted content in the file.
Is there any solution for this? And besides the redirection method (top > test) is there any other method to create a file with the top output?
I`m trying to use the output of Top command as an input for one of my scripts especially to find out the cpu load which is changeable in every second. So all I want to do is to wait for some seconds the generated output of Top and then retrieve it. Up to now I couldnt find anything and doing only this top > file gives me only the output of first appearence in screen.
Please could anyone help me on this topic if its possible
If you specify iterations with -n count , and delay with -d seconds , does it print multiple iterations to the file? For more detail on these options see man top .
If not, running top multiple times would be one obvious way to get output from multiple runs.