Loading...
top > usage.txttop -b -n 1 > usage.txtBatch mode prints one snapshot and exits; on macOS the same is top -l 1.
top in a script or CI step that then hangs forever.top -b -n 1 on Linux, top -l 1 on macOS) or ps, since interactive top never exits.Press q. Ctrl+C also works.
In Linux top, press M to sort by memory and P to go back to CPU. On macOS, start it with top -o mem.