List the UNIX groups I'm in

Blog

Easy enough:

$ groups
users www-data
$

So much easier than, say, the concatenation of these:

$ grep `whoami` /etc/group | cut -f1 -d: 
www-data
$ grep :`grep $USER /etc/passwd | cut -f4 -d:`: /etc/group | cut -f1 -d:
users
$

Add new comment