Linux Process Thread Count

Examples

On Linux, to get a thread count for particular process, issue:

ps UH p PID_OF_PROCESS | wc -l

Removing the pipe to the “| wc -l” yields more information about the running threads.

1 Comment

1 Comment

  1. Steve Parker  •  Nov 23, 2010 @12:22

    I don’t know what PS you’ve got, but on mine (RHEL5, , “-U” is for specifying a user, and “-H” does a forest of processes, but not threads.

    “awk ‘{ print $20 }’ /proc//stat” should do the job.

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>