Create a user

# add a new user, "nobody", to group "users"
useradd -m -g users -s /bin/bash nobody

# set the password of "nobody" to "nobody"
echo "nobody:nobody" | chpasswd

Create a new group

groupadd nogroup

Add “nobody” to group “nogroup”

usermod -a -G nogroup nobody

Get the list of gruops a user belongs to

groups nobody

List all groups

cat /etc/group

List all users and their groups

cat /etc/passwd