I can use the following command to get the effective group ID of a process:

ps -o pid,egid

But how can I get the supplementary groups IDs of a process?


The man page has these format specifiers:

supgid      SUPGID    group ids of supplementary groups, if any.  See getgroups(2).     
supgrp      SUPGRP    group names of supplementary groups, if any.  See getgroups(2).

So, ps -o supgid etc. Though if you use supgrp with some other columns, the default width might not fit all groups if there are many, so you may want to widen it, e.g.
ps -o pid,supgrp:100,args


On linux these are available for a process in /proc/pid/status:

-bash-4.2$ grep \^Groups /proc/$$/status
Groups: 6 9 11 18 100 1000

it may be useful to read through the proc(5) manual for what is stored in the various /proc files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.