Thursday, December 8, 2011

# of threads in a process under Linux

How to check number of threads in a process under Linux? top doesn't show it, but option "m" in ps will.
I put a space in front and after PID so it doesn't grep longer PID that contains the shorter PID in same sequence.

ps -elm | grep " $PID " | grep -v grep | wc -l
e.g.

ps -elm | grep " 9919 " | grep -v grep | wc -l

No comments: