Sunday, May 5, 2024
36
rated 0 times [  36] [ 0]  / answers: 1 / hits: 44512  / 2 Years ago, sat, october 29, 2022, 8:49:18

Is there any switch to tell top command in order to one time scan the system and do not monitor it all time?


More From » command-line

 Answers
4

The -n switch is what you search:



user@host:~$ top -n 1


See the manpage



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


If you want to stop top command just press q.



Notice: If you tend to use top in a script, I need to say top is not meant for scripts, use ps instead.


[#24588] Sunday, October 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
corsee

Total Points: 479
Total Questions: 122
Total Answers: 106

Location: Barbados
Member since Sat, May 9, 2020
4 Years ago
;