May 192009

top -b -n1 > /tmp/top.txt
This will run top once write the output to a file and exit. The command top can also be run so that it will give multiple reports. To run top 5 times and wait 5 seconds between each output the command would be:
top -b -n5 -d5 > /tmp/top.txt

 Posted by at 9:35 am

 Leave a Reply