How to get pids in one process group in Linux OS

dylanoo picture dylanoo · Oct 23, 2012 · Viewed 18k times · Source

I have one question on Linux pid things. How to get pids in one same group? It seems easy to get all pids or pgid with 'ps' command in Linux, but how to get the pids that belong to same group, or in other words, how to get the pids of one same program? Anyone please give me some help on this? Thank you!

Answer

Edw4rd picture Edw4rd · Oct 23, 2012

from man ps

To print a process tree:
      ps -ejH
      ps axjf

pstree can also help

Updated: Use pidof to find the process pids of the named programs. e.g. pidof chrome will get all chrome pids.