My favourite ps invocation is:

ps -efww ef

as I need to watch all processes (-e), get extended information about them (-f), see the environment (e) they operate within, wrapping lines (-w -w) so I don't lose any part of that, and visually group (f) child processes under their parents, for an at-a-glance overview.

I have "wasted" the whole morning trying to get any thread information to appear as well, following the same visualisation logic above. I must have tried 40 different combinations of options. (Actually, I just checked my .bash_history and I have tried more!). Combinations included swapping f and -H for forest display, for instance. Sometimes I even tried permutations to check insidious "orderings"...

None of the threading options seem to be compatible with my "monitoring screen" setup. I am talking about H, -L, m, -m and -T.

I am baffled. Am I doing it wrong? How are you guys doing it?

Specifically: I need to watch for processes like download managers who go funky with 30 to 80 threads all of a sudden...

  • 1
    I don't understand what you're trying to achieve. Yes, there are many ps options, and the syntax is confusing. But you're only saying what you don't want, not what you want. Are you trying to monitor the number of threads per process? Commented Oct 24, 2012 at 21:35

1 Answer 1


To watch for processes that create a lot of threads, I think all that's relevant is the number of threads per process, so go with

ps -o pid -o thcount

plus any option to select which processes to match, such as -e or -C. Run the command periodically and watch for sudden changes in thcount. This will give you approximate results (for example, you won't detect if a PID is reused between calls) but that should be good enough for your purpose.

Note that you can limit the number of threads per process:

(ulimit -T 20; downloadmanager)

You must log in to answer this question.

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