I recently had to check the number of threads being created by a process, for instance, a java application.

We can do the same using the following:

1
$ ps -o thcount <pid>

Tip: Use watch to monitor the same every 2 seconds.

1
$ watch ps -o thcount <pid>