What is the use of /etc/group file in Linux?

In this article, you will learn about What is the use of /etc/group file in Linux?

The /etc/group is a text file that defines the groups to which users belong under Linux and Unix operating system. Under Linux/Unix, multiple users can be categorized into groups. Unix file system permissions are organized into three classes, user, group, and others.

The use of groups allows additional abilities to be delegated in an organized fashion, such as access to disks, printers, and other peripherals. This also helps to enable the superuser to delegate some administrative tasks to normal users.

cat /etc/group

It contains four filed separated by a colon. Below is the picture of the group file.

group file in Linux
Group file format

1. Group Name

This first column shows the group name.

2. Group Password

By default, there is no password in a group. But it can store encrypted passwords. So, this is useful to implement a privileged group.

3. Group ID (GID)

There must be a group ID for the user. You can see this number in your /etc/password file.

4. Member List

A comma-delimited list of the users belonging to the group.

To Check the current group settings

This is a good thing to check the group file and so, you can use the less command.

less /etc/group

To find a user’s group

If you want to check the user’s group then you can use the below command.

groups username

For example, I am checking the group information for the user amit, so the command will be.

groups amit

Display the only Group ID

If you want to check the id of the current user then type the below command.

id -g

So, if you want to check the id for a particular user then type the below command.

id -g username
id -gn username

To display the group ID and supplementary groups,

id -G
id -G username


In conclusion, you learned about the group file. This file is essential because it has information related to the users’ group. I hope you understand but if you have any questions, you can ask in the comment section.

Leave a Reply