I got a parent and a child process running, I know their IDs.How do I utilize 'ps' and 'watch' to filter them out, so that I can see their used CPU times?I tried 'watch ps -u USERNAME', but as you can imagine there are a lot more processes than the desired ones.
Using ps and watch to observe parent and child process
terminal;process;ps;watch
If the PIDs are e.g. 340 and 520, then you can try the following:$ watch --interval 2 --difference ps -p 340,520 -o pid,ppid,%cpu,cputimeHere watch will mark the difference of outputs running with 2 seconds interval, here we have used the output formatting -o option to get only process ID (pid), parent process ID (ppid), percentage of cpu utilization (%cpu) and the cpu time (cputime).Check man ps for more ps output formatting options.