Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to be able to get the number of thread per process in command-line and get the exact same number I can see via the Activity Monitor.

At the moment the IntelliJ IDEA process (PID 5235) has 266 Thread. I'd like to get this number but via a command line.

I've tried

lsof -p 5235 | wc -l

Any suggestions?

share|improve this question

migrated from serverfault.com May 15 '14 at 7:03

This question came from our site for system and network administrators.

1 Answer 1

up vote 3 down vote accepted

Try the following:

NUM=`ps M <pid> | wc -l | xargs` && expr $NUM - 1
share|improve this answer
    
Exactly what I was looking for. Thanks you so much ;) –  TheEwook May 15 '14 at 9:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.