Hi, have to list current running processes (including sub-processes/child processes). im using ps -eo etime,pid,cmd | grep "process_name"
But sometimes, the command is not listing the sub-processes. I assume all processes (processes and sub-processes ) are listed only with ps -ef command, but not with my ps -eo command mentioned above.
None, except output formatting
From the linux man page for ps(1)
To see every process on the system using standard syntax:
ps -e
ps -ef
ps -eF
ps -ely
To see every process with a user-defined format:
ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
Your problem is what the grep statement does to output. Process names for a subprocess do not necessarily display the same when you specify output fields. Plus, sub-processes may come and go rapidly. ex: when you execute a shell script with commands like: ls, awk, grep, etc. Sub-processes do not have to have the same runtime duration as the parent.
To get a completely correct answer, please help us with:
Exact OS name ( uname -a )
Edit:
Consider using the process tree (Linux example):
And how do you find the "sub-process-name"? It needs to be a two-step approach - first find the parent process in question, then, with its PID, find all processes whose PPID (parent PID) is PID.
What about sub-subprocesses?