Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux: How to get group id from group name? and vice versa?

Tags:

linux

bash

I want to retrieve group id of a particular group name. Is there a command in Linux/UNIX systems to do this? Also if I want to do it the other way - get group name from group id, is that also possible?

like image 460
Kedar Joshi Avatar asked Mar 30 '15 21:03

Kedar Joshi


People also ask

How do I find group ID and group name in Linux?

I saw here that you can use the id command to get gid or uid from group name or username respectively. man page for id says last argument is username, so id -g foo will display the name of the main group for user "foo".

What is group ID in Linux?

1) In a Unix system, a GID (group ID) is a name that associates a system user with other users sharing something in common (perhaps a work project or a department name).


1 Answers

# getent group 124
mysql:x:124:

# getent group mysql
mysql:x:124:
like image 67
kberg Avatar answered Oct 21 '22 04:10

kberg