top

From RaySoft

The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel. The types of system summary information shown and the types, order and size of information displayed for tasks are all user configurable and that configuration can be made persistent across restarts.[1]

Documentation

Syntax

top [PARAMETER ...]

Parameters

-b
Starts top in Batch mode, which could be useful for sending output from top to other programs or to a file. In this mode, top will not accept input and runs until the iterations limit you've set with the -n command-line option or until killed.
-n NUMBER
Specifies the maximum NUMBER of iterations, or frames, top should produce before ending.

Examples

Send output to a file
top -bn 5 >'/tmp/tmp_output.txt'

References

  1. man 1 'top'