90

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

Ian F
  • 2,221

2 Answers2

122

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

groups
yivi
  • 105
Ian F
  • 2,221
34

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

Volo
  • 451
  • 4
  • 8