0
0
Linux CLIscripting~5 mins

groups and group management in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a group in Linux?
A group in Linux is a collection of users that share the same permissions. It helps manage access to files and resources easily by assigning rights to the group instead of individual users.
Click to reveal answer
beginner
Which command shows the groups a user belongs to?
The groups command followed by a username shows all groups that user belongs to. For example, groups alice lists Alice's groups.
Click to reveal answer
beginner
How do you add a new group in Linux?
Use the groupadd command followed by the group name. For example, sudo groupadd developers creates a new group called 'developers'.
Click to reveal answer
intermediate
How can you add a user to an existing group?
Use the usermod -aG groupname username command. The -aG option appends the user to the group without removing them from other groups. Example: sudo usermod -aG developers alice.
Click to reveal answer
intermediate
What file stores group information on a Linux system?
The /etc/group file stores all group information including group names, group IDs, and members. You can view it with cat /etc/group.
Click to reveal answer
Which command creates a new group named 'testers'?
Agroupadd testers
Baddgroup testers
Cnewgroup testers
Dcreategroup testers
How do you list all groups a user 'bob' belongs to?
Alistgroups bob
Bgroups bob
Cshowgroups bob
Dusergroups bob
What does the command usermod -aG admins alice do?
ACreates a new user alice in admins group
BRemoves alice from all groups except admins
CDeletes the admins group
DAdds user alice to the admins group without removing other groups
Where is group information stored on a Linux system?
A/etc/group
B/etc/passwd
C/etc/shadow
D/var/group
Which command shows the current user's groups?
Aid
Bwhoami
Cgroups
Dgetent
Explain how to add a user to a group and why it is useful.
Think about how groups help share access and the command to add users.
You got /3 concepts.
    Describe where Linux stores group information and how you can view it.
    It's a text file that lists all groups on the system.
    You got /3 concepts.