I'm trying to find my current logged in group without wanting to use newgrp to switch.

  • 3
    Generally you belong to several groups, which you can simply find with groups! – cylgalad Jan 3 '16 at 9:42

I figured I can use the following.

id -g

To get all the groups I belong

id -G

And to get the actual names, instead of the ids, just pass the flag -n.

id -Gn

This last command will yield the same result as executing

  • 7
    and id -G to the other groups you belong to. – Rui F Ribeiro Jan 3 '16 at 10:32
  • 7
    Add -n to see group names instead of GIDs: id -gn and id -Gn respectively. – misko321 Jul 15 '16 at 11:13

To get group name needed one more flag: id -g -n

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.