Friday, April 27, 2012

Linux: View GID by Group Name

I just wanted to save this for me so that I can't forget this. For example, if you want to view the GID of group "dialout", issue the command below.

$> groupname=dialout
$> sed -nr "s/^$groupname:x:([0-9]+):.*/\1/p" /etc/group


This is helpful since there's no command like "id" can do for a group.


1 comment:

Anonymous said...

bloddy shit
nothing worked
spent half an hour on it
go to hell u suckers