Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get pids in one process group in Linux OS

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!

like image 477
dylanoo Avatar asked Jan 15 '23 06:01

dylanoo


1 Answers

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.

like image 55
Edw4rd Avatar answered Jan 28 '23 21:01

Edw4rd