7

Is there any way to list only those processes which are hung, i.e., "not responding", in Terminal?

The only way I know to do this is look in Activity Monitor for the ones in red.

1 Answer 1

4

You can use the following command:

ps aux | grep -w Z

From ps man page:

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'').
6
  • works great, I see dozen Google Chrome He.
    – Ruskes
    Commented Jan 30, 2015 at 18:52
  • Cool, but that returns the processes grep -w Z (which I guess is the search itself) and (Google Drive Ico) which I don't know what that is?
    – d0g
    Commented Jan 30, 2015 at 18:56
  • @Ze'ev do you use the Google Drive? on line only or have you installed it?
    – Ruskes
    Commented Jan 30, 2015 at 18:57
  • yes, but why would it list that as zombie? and it's not even the gdrive process
    – d0g
    Commented Jan 30, 2015 at 18:58
  • ps isn't going to help any. A process 'not responding' means that it is not going back to WaitNextEvent (which in Cocoa terms means it's not giving it's main NSRunLoop a chance to run). It does not mean the program is idle or asleep or stopped or uninterruptible or dead. Quite the contrary; it usually means the program is very busy, so busy it has stopped paying attention to the outside world. It may be processing a huge amount of work, or it may be in a loop accomplishing nothing, or it may mean it's listening for work on another channel (a mach port, for example).
    – ganbustein
    Commented Jan 30, 2015 at 23:14

You must log in to answer this question.

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