Article updated on

How to find out the amount of Threads used by a Process in Linux

List of commands I normally use for this task:

To get the PID:

  • ps -ef | grep myprocess  Example: ps -ef | grep /sbin/init

To monitor those threads in TOP:

  • top -p (PID) -H   Example: top 1 -p -H

To find out the amount of Threads used by that process

  • cat /proc/(PID)/status | grep Threads Example: cat /proc/1/status | grep Threads

 

Console:

root@jcgonzalez:# cat /proc/1/status | grep Threads
Threads:        1