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?
Best Answer
Try the following:
We subtract 1 from the line count because
ps
outputs a HEADER in the 1st line.