Under Linux, I can use top to see a live report of what processes are running. An important field I use is the Process Status field, which shows whether a process is running, a zombie, sleeping, etc.

I was reading the Mac OS X manpage for top, but I don't see Process Status. https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/top.1.html

Is there another way of doing this from the command line in OS X? I'm debugging a program that uses fork(), so I need something that shows me a live feed of the processes currently being executed.


In OS X's version of top the field is called STATE and it shows you what state the process is in. For information on the stuck state see: https://apple.stackexchange.com/a/58718/292

The ps command on OS X can also show process status. For example, ps aux includes the STATE field. And the ps man page has this to say about the field:

 state     The state is given by a sequence of characters, for example, ``RWNA''.  The first character indicates the run state of the process:

           I       Marks a process that is idle (sleeping for longer than about 20 seconds).
           R       Marks a runnable process.
           S       Marks a process that is sleeping for less than about 20 seconds.
           T       Marks a stopped process.
           U       Marks a process in uninterruptible wait.
           Z       Marks a dead process (a ``zombie'').

           Additional characters after these, if any, indicate additional state information:

           +       The process is in the foreground process group of its control terminal.
           <       The process has raised CPU scheduling priority.
           >       The process has specified a soft limit on memory requirements and is currently exceeding that limit; such a process is (necessarily) not swapped.
           A       the process has asked for random page replacement (VA_ANOM, from vadvise(2), for example, lisp(1) in a garbage collect).
           E       The process is trying to exit.
           L       The process has pages locked in core (for example, for raw I/O).
           N       The process has reduced CPU scheduling priority (see setpriority(2)).
           S       The process has asked for FIFO page replacement (VA_SEQL, from vadvise(2), for example, a large image processing program using virtual memory to sequentially
                   address voluminous data).
           s       The process is a session leader.
           V       The process is suspended during a vfork(2).
           W       The process is swapped out.
           X       The process is being traced or debugged.
  • Sadly, even with top -stats pstate, I couldn't get top to show zombies. So, looks like using ps is the way. – 425nesp Oct 5 '14 at 5:56

OS X also has the top command. Since OS X is BSD-based, there may be usage differences. For more information, see man top.

You may find it easier to ps ax | grep 'Z', for example, to find zombie processes. top may not do what you want precisely.

  • 1
    The OP has read the manual page look at the second paragraph – user151019 Sep 23 '14 at 22:02
  • Cheers, Mark. Thanks for that. Answer updated accordingly. – Trane Francks Sep 23 '14 at 23:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .