How to save the output from top/atop

1

I wanted to know if there a way to save the output from top or atop commands into a textfile for later processing.

atop|top > output.txt is not really working at both top and atop keep running in the background.

edit:

OS: RHEL 6

other attempts: top | awk 'fflush(stdout)'

user1745713

Posted 2014-07-02T20:10:57.883

Reputation: 131

possible duplicate of How to redirect values from top command to a file in Mac OSX

– Ƭᴇcʜιᴇ007 – 2014-07-02T20:13:54.973

not quite, I can't seem to be able to get this working on my RedHat box – user1745713 – 2014-07-02T20:22:40.223

Please edit your question to include which OS and version you are using, as well as adding a complete list of what you've tried already (and the results). – Ƭᴇcʜιᴇ007 – 2014-07-02T20:24:03.640

Answers

1

Found the way to it in top is:

top -n 1

the -n specifies the number of iterations you want top to perform, still interested on how to accomplish the same with atop.

user1745713

Posted 2014-07-02T20:10:57.883

Reputation: 131

0

For atop it is:

atop -r /var/log/atop/atop_20180204 -PALL or

take 5 samples 10 seconds apart

atop -PALL 10 5

Wayne Walker

Posted 2014-07-02T20:10:57.883

Reputation: 206