Alright, so as I wanted to post some basic group commands in Linux. Since it’s not an operating system I use full time I have a hard time remembering little things; so I figured I’d create a little post.
Now let’s open a terminal and have some fun.
Adding a Existing User Account to a Group….
sudo usermod -a -G yourgroup yourusername
Add a New Group
sudo groupadd thenewgroup
Viewing the Groups a User Account is a Member of
groups
or if you want numerical ID’s associated with your groups
id
Creating a New User and Assigning him/her to a Existing Group
sudo useradd -G groupname username
Adding a User to Multiple Groups
usermod -a -G grp1,grp2,grp3 username
Viewing All Groups on your System
getent group



