I am trying to see the number of active puma threads on my server.
I can not see it through ps
:
$ ps aux | grep puma
healthd 2623 0.0 1.
Using ps
and wc
to count puma
threads:
ps --no-headers -T -C puma | wc -l
The string "puma" can be replaced as desired. Example, count bash
threads:
ps --no-headers -T -C bash | wc -l
On my system that outputs:
9
The code in the question, ps aux | grep puma
, has a few grep
related problems:
grep --color=auto puma
, which isn't a puma
thread at all.notpuma
, would be matched by grep
.