4

I want top to just give me the results when I call it and then exit. How can this be done?

top's manpage does not list any flag for this purpose.

Also, I do not want to use ps -eLf for the purpose.

1 Answer 1

6

From the top manpage:

-n : Number of iterations limit as:  -n number
        Specifies the maximum number of iterations,
        or frames, top should produce before ending.

So just run:

top -n 1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .