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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

Your Answer


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.