UNIX Question and Answer – Group Management
UNIX MCQ – Multiple Choice Questions for exam, interview, and Entrance Test
1. Which command is used to display the group ID (GID) of a specific group in UNIX?
a) getent group
b) id
c) showgroup
d) gid
Answer: a) getent group
Explanation: The getent group command displays the group ID (GID) of a specific group in UNIX.
2. What is the purpose of the -R option with the groupmod command?
a) Change the group owner
b) Set the maximum number of members for the group
c) Remove the group’s directory
d) Set the group ID range
Answer: d) Set the group ID range
Explanation: The -R option with groupmod is used to set the group ID range in UNIX.
3. Which command is used to change the primary group of a user in UNIX?
a) chgroup
b) primarygroup
c) usermod
d) setprimarygroup
Answer: c) usermod
Explanation: The usermod command is used to change the primary group of a user in UNIX.
4. What is the purpose of the -i option with the groupdel command?
a) Remove the group from the system
b) Prompt for confirmation before deletion
c) Remove all users from the group before deletion
d) Remove the group’s directory
Answer: b) Prompt for confirmation before deletion
Explanation: The -i option with groupdel prompts for confirmation before deleting a group in UNIX.
5. Which command is used to display detailed information about a specific group in UNIX?
a) showgroup
b) getent group
c) groupinfo
d) info
Answer: b) getent group
Explanation: The getent group command displays detailed information about a specific group in UNIX.
6. What is the purpose of the -M option with the groupadd command?
a) Change the group name
b) Add or remove users from the group
c) Set the maximum number of members for the group
d) Set the default group
Answer: b) Add or remove users from the group
Explanation: The -M option with groupadd is used to add or remove users from the group in UNIX.
7. Which command is used to list all groups a user is a member of in UNIX?
a) listgroups
b) usergroups
c) groups
d) getgroups
Answer: c) groups
Explanation: The groups command lists all groups a user is a member of in UNIX.
8. What is the purpose of the -f option with the groupmod command?
a) Forcefully modify the group
b) Set the group password
c) Change the group description
d) Set the expiration date for the group
Answer: a) Forcefully modify the group
Explanation: The -f option with groupmod forcefully modifies the group in UNIX.
9. Which command is used to change the group owner of a directory and its contents recursively in UNIX?
a) chgrp
b) chown
c) setgroup
d) changegroup
Answer: b) chown
Explanation: The chown command is used to change the group owner of a directory and its contents recursively in UNIX.
10. What is the purpose of the -l option with the groupmod command?
a) Change the group name
b) Set the group password
c) Change the group description
d) Set the maximum number of members for the group
Answer: c) Change the group description
Explanation: The -l option with groupmod is used to change the group description in UNIX.
11. Which command is used to change the group password in UNIX?
a) passwd
b) chgrp
c) setgroup
d) groupmod
Answer: a) passwd
Explanation: The passwd command is used to change the group password in UNIX.
12. What is the purpose of the -n option with the groupmod command?
a) Change the group name
b) Set the expiration date for the group
c) Change the group owner
d) Change the group ID
Answer: a) Change the group name
Explanation: The -n option with groupmod changes the name of a group in UNIX.
13. Which command is used to change the group membership of multiple users in UNIX?
a) usermod
b) chgroup
c) setgroup
d) modifygroup
Answer: a) usermod
Explanation: The usermod command is used to change the group membership of multiple users in UNIX.
14. What is the purpose of the -P option with the groupmod command?
a) Set the expiration date for the group
b) Set the maximum number of members for the group
c) Change the group description
d) Set the group owner
Answer: a) Set the expiration date for the group
Explanation: The -P option with groupmod is used to set the expiration date for the group in UNIX.
15. Which command is used to display the members of a specific group in UNIX?
a) showmembers
b) getent group
c) listmembers
d) members
Answer: b) getent group
Explanation: The getent group command displays the members of a specific group in UNIX.
16. What is the purpose of the -N option with the groupadd command?
a) Set the expiration date for the group
b) Prevent the creation of a group with the same name as an existing user
c) Set the maximum number of members for the group
d) Set the group password
Answer: b) Prevent the creation of a group with the same name as an existing user
Explanation: The -N option with groupadd prevents the creation of a group with the same name as an existing user in UNIX.
17. Which command is used to remove a user from a group in UNIX?
a) usermod
b) deluser
c) userdel
d) removeuser
Answer: a) usermod
Explanation: The usermod command is used to remove a user from a group in UNIX.
18. What is the purpose of the -o option with the groupmod command?
a) Allow non-unique GIDs
b) Change the group password
c) Set the expiration date for the group
d) Change the group owner
Answer: a) Allow non-unique GIDs
Explanation: The -o option with groupmod allows non-unique GIDs (Group IDs) in UNIX.
19. Which command is used to display the primary group of a user in UNIX?
a) id
b) groups
c) primarygroup
d) usergroup
Answer: a) id
Explanation: The id command is used to display user and group information, including the primary group, in UNIX.
20. What is the purpose of the -R option with the groupadd command?
a) Set the default group
b) Set the group password
c) Set the group ID range
d) Set the group owner
Answer: c) Set the group ID range
Explanation: The -R option with groupadd is used to set the group ID range in UNIX.
21. Which command is used to list all users belonging to a specific group in UNIX?
a) getent passwd
b) showgroup
c) listgroup
d) getent group
Answer: d) getent group
Explanation: The getent group command lists all users belonging to a specific group in UNIX.
22. What is the purpose of the -d option with the groupdel command?
a) Remove the group’s directory
b) Prompt for confirmation before deletion
c) Remove the group from the system
d) Change the group name
Answer: a) Remove the group’s directory
Explanation: The -d option with groupdel removes the group’s directory along with the group in UNIX.
23. Which command is used to change the group membership of a user in UNIX?
a) changegroup
b) setgroup
c) chgroup
d) usermod
Answer: d) usermod
Explanation: The usermod command is used to change the group membership of a user in UNIX.
24. What is the purpose of the -E option with the groupmod command?
a) Set the expiration date for the group
b) Change the group description
c) Set the maximum number of members for the group
d) Change the group owner
Answer: b) Change the group description
Explanation: The -E option with groupmod is used to change the description of a group in UNIX.
25. Which command is used to change the group owner of a file in UNIX?
a) chown
b) chgrp
c) setgroup
d) changegroup
Answer: b) chgrp
Explanation: The chgrp command is used to change the group owner of a file in UNIX.
26. Which command is used to create a new group with a specific GID (Group ID) in UNIX?
a) groupcreate
b) groupnew
c) addgroup
d) groupadd
Answer: d) groupadd
Explanation: The groupadd command is used to create a new group with a specific GID in UNIX.
27. What is the purpose of the -U option with the groupmod command?
a) Remove the group password
b) Change the group owner
c) Unlock a locked group
d) Change the GID of a group
Answer: c) Unlock a locked group
Explanation: The -U option with groupmod is used to unlock a locked group in UNIX.
28. Which command is used to change the group owner of a symbolic link in UNIX?
a) chgrp
b) chown
c) changegroup
d) setgroup
Answer: a) chgrp
Explanation: The chgrp command is used to change the group owner of a symbolic link in UNIX.
29. What is the purpose of the -E option with the groupmod command?
a) Change the group description
b) Set the expiration date for the group
c) Change the maximum number of members for the group
d) Modify the group’s access control list (ACL)
Answer: a) Change the group description
Explanation: The -E option with groupmod is used to change the description of a group in UNIX.
30. Which command is used to change the primary group of a user in UNIX?
a) setprimarygroup
b) chgroup
c) usermod
d) primarygroup
Answer: c) usermod
Explanation: The usermod command is used to change the primary group of a user in UNIX.
31. What is the purpose of the -r option with the groupadd command?
a) Remove the group’s directory
b) Create a system group
c) Set the group password
d) Rename the group
Answer: b) Create a system group
Explanation: The -r option with groupadd is used to create a system group in UNIX.
32. Which command is used to display the primary group of a user in UNIX?
a) primarygroup
b) usergroup
c) id
d) groups
Answer: c) id
Explanation: The id command displays user and group information, including the primary group, in UNIX.
33. What is the purpose of the -p option with the groupmod command?
a) Change the group owner
b) Change the group password
c) Set the maximum number of members for the group
d) Add users to the group
Answer: b) Change the group password
Explanation: The -p option with groupmod is used to change the password of a group in UNIX.
34. Which command is used to remove a user from a group in UNIX?
a) userdel
b) deluser
c) removeuser
d) usermod
Answer: d) usermod
Explanation: The usermod command is used to remove a user from a group in UNIX.
35. What is the purpose of the -n option with the groupmod command?
a) Change the group name
b) Change the maximum number of members for the group
c) Change the group owner
d) Change the group ID
Answer: a) Change the group name
Explanation: The -n option with groupmod changes the name of a group in UNIX.
36. Which command is used to change the group password in UNIX?
a) setgroup
b) chgrp
c) groupmod
d) passwd
Answer: d) passwd
Explanation: The passwd command is used to change the group password in UNIX.
37. What is the purpose of the -g option with the groupadd command?
a) Add users to the group
b) Change the group ID
c) Set the group password
d) Set the group owner
Answer: b) Change the group ID
Explanation: The -g option with groupadd changes the group ID (GID) of the new group in UNIX.
38. Which command is used to display detailed information about a specific group in UNIX?
a) groupinfo
b) showgroup
c) getent group
d) info
Answer: c) getent group
Explanation: The getent group command displays detailed information about a specific group in UNIX.
39. What is the purpose of the -i option with the groupmod command?
a) Prompt for confirmation before modification
b) Change the group ID
c) Set the expiration date for the group
d) Unlock a locked group
Answer: a) Prompt for confirmation before modification
Explanation: The -i option with groupmod prompts for confirmation before modifying a group in UNIX.
40. Which command is used to display the members of a specific group in UNIX?
a) members
b) showmembers
c) listmembers
d) getent group
Answer: d) getent group
Explanation: The getent group command displays the members of a specific group in UNIX.
41. What is the purpose of the -o option with the groupmod command?
a) Allow non-unique GIDs
b) Set the expiration date for the group
c) Change the group owner
d) Modify the group’s access control list (ACL)
Answer: a) Allow non-unique GIDs
Explanation: The -o option with groupmod allows non-unique GIDs (Group IDs) in UNIX.
42. Which command is used to change the group membership of multiple users in UNIX?
a) modifygroup
b) setgroup
c) usermod
d) chgroup
Answer: c) usermod
Explanation: The usermod command is used to change the group membership of multiple users in UNIX.
43. What is the purpose of the -N option with the groupadd command?
a) Set the expiration date for the group
b) Prevent the creation of a group with the same name as an existing user
c) Set the maximum number of members for the group
d) Set the group password
Answer: b) Prevent the creation of a group with the same name as an existing user
Explanation: The -N option with groupadd prevents the creation of a group with the same name as an existing user in UNIX.
44. Which command is used to list all groups a user is a member of in UNIX?
a) usergroups
b) groups
c) listgroups
d) showgroups
Answer: b) groups
Explanation: The groups command lists all groups a user is a member of in UNIX.
45. What is the purpose of the -d option with the groupdel command?
a) Remove the group’s directory
b) Prompt for confirmation before deletion
c) Remove the group from the system
d) Change the group name
Answer: a) Remove the group’s directory
Explanation: The -d option with groupdel removes the group’s directory along with the group in UNIX.
46. Which command is used to change the group owner of a file in UNIX?
a) chown
b) changegroup
c) setgroup
d) chgrp
Answer: d) chgrp
Explanation: The chgrp command is used to change the group owner of a file in UNIX.
47. What is the purpose of the -K option with the groupmod command?
a) Set the expiration date for the group
b) Set the maximum number of members for the group
c) Change the group description
d) Change the group owner
Answer: c) Change the group description
Explanation: The -K option with groupmod is used to change the description of a group in UNIX.
48. Which command is used to change the group ID (GID) of a group in UNIX?
a) modifygid
b) groupmod
c) changegid
d) setgid
Answer: b) groupmod
Explanation: The groupmod command is used to change the group ID (GID) of a group in UNIX.
49. What is the purpose of the -M option with the groupmod command?
a) Add or remove users from the group
b) Set the maximum number of members for the group
c) Change the group name
d) Set the group password
Answer: a) Add or remove users from the group
Explanation: The -M option with groupmod is used to add or remove users from the group in UNIX.
50. Which command is used to change the group membership of a user in UNIX?
a) chgroup
b) usermod
c) modifygroup
d) setgroup
Answer: b) usermod
Explanation: The usermod command is used to change the group membership of a user in UNIX.