Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.