Ubuntu Linux Server List User Groups Command

by on January 25, 2014 · 0 comments· LAST UPDATED January 25, 2014

Fig. 01: groups and id command on Ubuntu

You need to use either id command or groups command as follows to list Ubuntu server group membership:

$ id userNameHere
$ id -G -n userNameHere
$ groups userNameHere

Another option is to query a file called /etc/group directly using either grep command or cat command as follows:
$ less /etc/group
$ grep userNameHere /etc/group
$ cat /etc/group

Sample outputs

cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
libuuid:x:101:
crontab:x:102:
syslog:x:103:
fuse:x:104:
messagebus:x:105:
mlocate:x:106:
ssh:x:107:
bluetooth:x:108:
ntp:x:109:
vivek:x:1000:
mysql:x:110:
wwwjobs:x:1001:
TwitterFacebookGoogle+Found an error/typo on this page? Help us!

Examples and usage: Ubuntu Linux: Find Groups A User Belongs To

{ 0 comments… add one now }

Leave a Comment

Tagged as: