Reputation: 93
How to get list of PID's of the processes in the group of the process which is current, using ps one line. I have tried:
ps -g $$
but $$
is not group id but only PID
How do I get PGID
of `$$'?
Upvotes: 0
Views: 2324
Reputation: 856
Why not use pgrep
?
pgrep -g0
gives you the list of PID's of the processes in the group of the process which is current. (See man pgrep
)
Note that the command outputs nothing, if job control (set -m
) is active in shell, because current process has a new process group then.
Upvotes: 0