Answers:
top -b
似乎在解决问题。
-n1
选项将给出一个整页,然后退出。
top -l1
可以在OS X / macOS中列出所有具有状态的进程,尽管%CPU对于带有-l的单个样本来说是不正确的,因为它是使用样本之间的差异来计算的。
您可以使用coreutils获取进程状态 ps
$ ps aux
将列出所有这些,以及更多。您可以从手册页中解码它们:
过程状态码
以下是s,stat和状态输出说明符(标题“ STAT”或“ S”)将显示的不同值,以描述进程的状态:
D uninterruptible sleep (usually IO)
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent.
对于BSD格式,当使用stat关键字时,可能会显示其他字符:
< high-priority (not nice to other users)
N low-priority (nice to other users)
L has pages locked into memory (for real-time and custom IO)
s is a session leader
l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+ is in the foreground process group.
htop
。它的进程列表是可滚动的。