Last Updated:

How do I capture the output of “top” to a file?

Categories CLI

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.

top -b -n1 > /tmp/top.txt

To run top 5 times and wait 5 seconds between each output the command would be:

top -b -n5 -d5 > /tmp/top.txt

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.