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
✗ Incorrect
The correct command to create a new group is groupadd testers. Other options are incorrect commands.
How do you list all groups a user 'bob' belongs to?
Alistgroups bob
Bgroups bob
Cshowgroups bob
Dusergroups bob
✗ Incorrect
The groups bob command lists all groups for user 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
✗ Incorrect
The -aG option appends alice to the admins group without removing her from other groups.
Where is group information stored on a Linux system?
A/etc/group
B/etc/passwd
C/etc/shadow
D/var/group
✗ Incorrect
Group information is stored in the /etc/group file.
Which command shows the current user's groups?
Aid
Bwhoami
Cgroups
Dgetent
✗ Incorrect
Running groups without arguments shows the current user's groups.
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.
Practice
(1/5)
1. What is the primary purpose of groups in Linux?
easy
A. To organize users for shared access to files and resources
B. To install software packages
C. To monitor system performance
D. To create user passwords
Solution
Step 1: Understand the role of groups
Groups in Linux are used to organize users so they can share access to files and resources easily.
Step 2: Eliminate unrelated options
Installing software, monitoring performance, and creating passwords are unrelated to groups.
Final Answer:
To organize users for shared access to files and resources -> Option A
Quick Check:
Groups = shared user access [OK]
Hint: Groups help users share files easily [OK]
Common Mistakes:
Confusing groups with user accounts
Thinking groups manage software
Assuming groups handle passwords
2. Which command correctly creates a new group named developers?
easy
A. creategroup developers
B. addgroup developers
C. newgroup developers
D. groupadd developers
Solution
Step 1: Recall the standard command for adding groups
The standard Linux command to create a group is groupadd.
Step 2: Check each option
Only groupadd developers is valid; others are incorrect or non-existent commands.
Final Answer:
groupadd developers -> Option D
Quick Check:
Use groupadd to create groups [OK]
Hint: Use groupadd to create groups [OK]
Common Mistakes:
Using non-existent commands like addgroup
Confusing user creation commands with group commands
Misspelling the command
3. What is the output of the command groups alice if Alice belongs to groups users and developers?
medium
A. groups: alice users developers
B. users developers
C. alice : users developers
D. alice users, developers
Solution
Step 1: Understand the groups command output format
The groups username command outputs the username followed by a colon and the list of groups.
Step 2: Match the output format
The correct output is "alice : users developers" with a space after the colon and groups separated by spaces.
Final Answer:
alice : users developers -> Option C
Quick Check:
groups username = username : groups [OK]
Hint: groups username shows username : group1 group2 [OK]
Common Mistakes:
Omitting the username in output
Using commas instead of spaces
Adding extra words like 'groups:'
4. You run groupdel developers but get an error saying the group does not exist. What is the most likely cause?
medium
A. The group name is misspelled or does not exist
B. You need to reboot the system first
C. The user running the command is not logged in
D. The group is currently in use by a user
Solution
Step 1: Understand groupdel error causes
If groupdel says the group does not exist, it usually means the group name is wrong or missing.
Step 2: Evaluate other options
Rebooting is not needed; user login status does not affect group deletion; groups in use can be deleted but may cause issues, not this error.
Final Answer:
The group name is misspelled or does not exist -> Option A
Quick Check:
groupdel error = wrong group name [OK]
Hint: Check group name spelling before deleting [OK]
Common Mistakes:
Assuming reboot fixes group errors
Thinking user login affects group deletion
Ignoring spelling mistakes
5. You want to add user bob to the existing group admins without changing his primary group. Which command should you use?
hard
A. usermod -G admins bob
B. usermod -aG admins bob
C. groupadd -a bob admins
D. groupmod -a bob admins
Solution
Step 1: Identify the correct command to add a user to a supplementary group
The usermod -aG group user command appends the user to the group without removing existing groups.
Step 2: Check other options for correctness
groupadd creates groups, not add users; usermod -G replaces groups instead of appending; groupmod modifies groups, not user membership.
Final Answer:
usermod -aG admins bob -> Option B
Quick Check:
Append user to group with usermod -aG [OK]
Hint: Use usermod -aG to add user to groups safely [OK]
Common Mistakes:
Using -G without -a which removes other groups
Trying to add users with groupadd or groupmod
Confusing primary and supplementary groups
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.