On my Linux server I run tomcat as root and when I run ps aux
it gives the following output.
root 25667 0.1 29.2 4574004 306980 ? Sl Apr27 33:57 /usr/local/java/bin/java -Djava.util.logging.config.file...
Thre is only parent process, but when I run htop
I can see all other child process (which are threads?). Sample output for a few lines given below.
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
25668 root 15 0 4466M 299M 14208 S 0.0 29.3 0:01.23 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/t
25669 root 18 0 4466M 299M 14208 S 0.0 29.3 0:54.84 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/t
25670 root 15 0 4466M 299M 14208 S 0.0 29.3 0:00.25 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/t
25671 root 15 0 4466M 299M 14208 S 0.0 29.3 0:00.54 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/t
25672 root 18 0 4466M 299M 14208 S 0.0 29.3 0:00.00 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/t
25673 root 15 0 4466M 299M 14208 S 0.0 29.3 0:17.96 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/t
25674 root 15 0 4466M 299M 14208 S 0.0 29.3 0:20.01 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/t
25675 root 19 0 4466M 299M 14208 S 0.0 29.3 0:00.00 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/t
So I want to get child process list with a single command. I set maxThreads to 200 in config file, and want to check current thread count by counting child threads.
Best Answer
Easy enough to do:
ps -eLf | grep java
Might have to adjust (grep can be refined to get what you're looking for).