如何关闭unix命令“top”的实时显示?

Laz*_*zer 4 top

我只想top在我调用它然后退出时给我结果。如何才能做到这一点?

top联机帮助页没有为此目的列出任何标志。

另外,我不想ps -eLf用于此目的。

Ste*_*fan 6

top 联机帮助页

-n : Number of iterations limit as:  -n number
        Specifies the maximum number of iterations,
        or frames, top should produce before ending.
Run Code Online (Sandbox Code Playgroud)

所以只需运行:

top -n 1
Run Code Online (Sandbox Code Playgroud)