How to create a user group and specify a group ID in Linux?

To create a user group in Linux and specify a group ID, you can use the groupadd command. The syntax for this command is as follows:

groupadd [选项] 组名

One option can be:

  1. -g: specify group ID
  2. Create a system user group with a group ID less than 1000.

For example, to create a user group named “developers” and assign a group ID of 1001, you can use the following command:

sudo groupadd -g 1001 developers

This will create a user group named “developers” with a group ID set to 1001. Please note that you need to use sudo or run this command as root to have sufficient permissions to create the user group.

bannerAds