How can I monitor the thread count of a process on linux?

前端 未结 17 1149
暖寄归人
暖寄归人 2020-12-02 03:53

I would like to monitor the number of threads used by a specific process on Linux. Is there an easy way to get this information without impacting the performance of the proc

17条回答
  •  误落风尘
    2020-12-02 04:25

    Here is one command that displays the number of threads of a given process :

    ps -L -o pid= -p  | wc -l
    

    Unlike the other ps based answers, there is here no need to substract 1 from its output as there is no ps header line thanks to the -o pid=option.

提交回复
热议问题