Is this a homework assignment? (If so, please see Rules for Homework & Coursework Questions Forum and repost in the Homework & Coursework Questions Forum. Otherwise, please explain where these questions came from.)
Welcome to forums,for your request. Following is an example which I have created for finding a java service you can search accordingly the processes and put it in condition highilighted, also this command only print the output,
if you are happy with command's output you can use it.
You can kill a process group leader and all of its descendants (at least those that have not become process group leaders on their own) by finding the process ID (PID) of the process group leader (using ps ) and then sending a signal to that PID with a leading minus sign (using kill ).
Note that unless you are running with elevated privileges, you won't be able to kill processes started by anyone but yourself.
Note also that using kill -9 attempts to terminate threads without giving them any chance to clean up what they were working on. This may be what you want, but it might also leave temporary files around that could have been cleaned up by a process before it terminated if it had been sent a SIGTERM signal instead of a SIGKILL signal.
Thank you. Let us say i have below process details...If i write dymanically based on the query you have provided will it be works..
Kindly please advise.Thank you.
Example-
Parent Process 1
Child Process 11
Subchild Process 111
Parent Process 2
Child Process 22
Subchild Process 222
1.What is the unix comand used for all current running process (Including All current running processes Parent ->child->subchild process)
Could you please try the following command which will only print the process ids in an order to kill (from child to parent ids) which is recomended as if we will kill parent before child it will create defunct processes. Also please don't try to use the command to kill processes, kindly validate it first as I don't have box to work on as of now, so I have not tested it.
Also you can grep for specific process too in the command but as a first step could you please try same and let us know if this helps or any issues you face with this, please provide os details you are working on.
The answer to your first question depends on the system you are using. On e.g. linux,
-H will show a process tree of children and grandchildren. They are connected through PID and PPID (parent PID).