Skip to main content
Fix typo: ppid -> pgid.
Source Link
Ingo Karkat
  • 12.2k
  • 2
  • 36
  • 48

For the effective group id, real group id and supplementary group ids (as used for access control):

ps -o gid,rgid,supgid -p "$pid"

gid and rgid are fairly portable, supgid less so (all 3 would be available with the ps from procps as typically found on Linux-based systems).

group, rgroup and supgrp can be used to translate group ids to group names, but note that for group ids that have several corresponding group names, only one of them will be shown (same as for ls -l vs ls -n or anything that deals with user or group names based on ids).

For the process group id (as used for terminal job control):

ps -o pgid -p "$pid"

To store it into a variable:

pgid=$(($(ps -o ppid=pgid= -p "$pid")))

For the effective group id, real group id and supplementary group ids (as used for access control):

ps -o gid,rgid,supgid -p "$pid"

gid and rgid are fairly portable, supgid less so (all 3 would be available with the ps from procps as typically found on Linux-based systems).

group, rgroup and supgrp can be used to translate group ids to group names, but note that for group ids that have several corresponding group names, only one of them will be shown (same as for ls -l vs ls -n or anything that deals with user or group names based on ids).

For the process group id (as used for terminal job control):

ps -o pgid -p "$pid"

To store it into a variable:

pgid=$(($(ps -o ppid= -p "$pid")))

For the effective group id, real group id and supplementary group ids (as used for access control):

ps -o gid,rgid,supgid -p "$pid"

gid and rgid are fairly portable, supgid less so (all 3 would be available with the ps from procps as typically found on Linux-based systems).

group, rgroup and supgrp can be used to translate group ids to group names, but note that for group ids that have several corresponding group names, only one of them will be shown (same as for ls -l vs ls -n or anything that deals with user or group names based on ids).

For the process group id (as used for terminal job control):

ps -o pgid -p "$pid"

To store it into a variable:

pgid=$(($(ps -o pgid= -p "$pid")))
added 74 characters in body
Source Link
Stéphane Chazelas
  • 585.1k
  • 96
  • 1.1k
  • 1.7k

For the effective group id, real group id and supplementary group ids (as used for access control):

ps -o gid,rgid,supgid -p "$pid"

gid and rgid are fairly portable, supgid less so (all 3 would be available with the ps from procps as typically found on Linux-based systems).

group, rgroup and supgrp can be used to translate group ids to group names, but note that for group ids that have several corresponding group names, only one of them will be shown (same as for ls -l vs ls -n or anything that deals with user or group names based on ids).

For the process group id (as used for terminal job control):

ps -o pgid -p "$pid"

To store it into a variable:

pgid=$(($(ps -o ppid= -p "$pid")))

For the effective group id, real group id and supplementary group ids (as used for access control):

ps -o gid,rgid,supgid -p "$pid"

gid and rgid are fairly portable, supgid less so (all 3 would be available with the ps from procps as typically found on Linux-based systems).

group, rgroup and supgrp can be used to translate group ids to group names, but note that for group ids that have several corresponding group names, only one of them will be shown (same as for ls -l vs ls -n or anything that deals with user or group names based on ids).

For the process group id (as used for terminal job control):

ps -o pgid -p "$pid"

For the effective group id, real group id and supplementary group ids (as used for access control):

ps -o gid,rgid,supgid -p "$pid"

gid and rgid are fairly portable, supgid less so (all 3 would be available with the ps from procps as typically found on Linux-based systems).

group, rgroup and supgrp can be used to translate group ids to group names, but note that for group ids that have several corresponding group names, only one of them will be shown (same as for ls -l vs ls -n or anything that deals with user or group names based on ids).

For the process group id (as used for terminal job control):

ps -o pgid -p "$pid"

To store it into a variable:

pgid=$(($(ps -o ppid= -p "$pid")))
added 261 characters in body
Source Link
Stéphane Chazelas
  • 585.1k
  • 96
  • 1.1k
  • 1.7k

For the effective group id, real group id and supplementary group ids (as used for access control):

ps -o gid,rgid,supgid -p "$pid"

gid and rgid are fairly portable, supgid less so (all 3 would be available with the ps from procps as typically found on Linux-based systems).

group, rgroup and supgrp can be used to translate group ids to group names, but note that for group ids that have several corresponding group names, only one of them will be shown (same as for ls -l vs ls -n or anything that deals with user or group names based on ids).

For the process group id (as used for terminal job control):

ps -o pgid -p "$pid"

For the effective group id, real group id and supplementary group ids (as used for access control):

ps -o gid,rgid,supgid -p "$pid"

gid and rgid are fairly portable, supgid less so (all 3 would be available with the ps from procps as typically found on Linux-based systems).

For the process group id (as used for terminal job control):

ps -o pgid -p "$pid"

For the effective group id, real group id and supplementary group ids (as used for access control):

ps -o gid,rgid,supgid -p "$pid"

gid and rgid are fairly portable, supgid less so (all 3 would be available with the ps from procps as typically found on Linux-based systems).

group, rgroup and supgrp can be used to translate group ids to group names, but note that for group ids that have several corresponding group names, only one of them will be shown (same as for ls -l vs ls -n or anything that deals with user or group names based on ids).

For the process group id (as used for terminal job control):

ps -o pgid -p "$pid"
Source Link
Stéphane Chazelas
  • 585.1k
  • 96
  • 1.1k
  • 1.7k
Loading