UNIX MCQs – Group Management (Part – 1)

UNIX Question and Answer – Group Management

UNIX MCQ – Multiple Choice Questions for exam, interview, and Entrance Test

1. Which command is used to create a new group in UNIX?

a) groupadd

b) groupcreate

c) groupnew

d) addgroup

Answer: a) groupadd

Explanation: The groupadd command is used to create a new group in UNIX.


2. What is the default location where group information is stored in UNIX?

a) /etc/groups

b) /etc/passwd

c) /etc/group

d) /var/groups

Answer: c) /etc/group

Explanation: The /etc/group file stores group information in UNIX.


3. Which command is used to modify a group in UNIX?

a) groupmodify

b) groupmod

c) modifygroup

d) changegroup

Answer: b) groupmod

Explanation: The groupmod command is used to modify a group in UNIX.


4. What option is used with the groupadd command to specify the GID (Group ID) of the new group?

a) -g

b) -i

c) -n

d) -d

Answer: a) -g

Explanation: The -g option with groupadd specifies the GID of the new group in UNIX.


5. Which command is used to delete a group in UNIX?

a) groupdelete

b) groupremove

c) groupdel

d) delgroup

Answer: c) groupdel

Explanation: The groupdel command is used to delete a group in UNIX.


6. What is the purpose of the -r option with the groupdel command?

a) Remove all users from the group before deleting

b) Remove the group’s directory

c) Remove the group from the system

d) Remove group-related files

Answer: b) Remove the group’s directory

Explanation: The -r option with groupdel removes the group’s directory along with the group.


7. Which command is used to display information about groups a user belongs to?

a) groups

b) usergroups

c) groupinfo

d) userinfo

Answer: a) groups

Explanation: The groups command displays information about groups a user belongs to in UNIX.


8. What command is used to change the name of a group in UNIX?

a) changegroup

b) groupchange

c) groupmod

d) renamegroup

Answer: c) groupmod

Explanation: The groupmod command is used to change the name of a group in UNIX.


9. Which command is used to list all groups in UNIX?

a) listgroups

b) showgroups

c) getgroups

d) getent group

Answer: d) getent group

Explanation: The getent group command lists all groups in UNIX.


10. What is the purpose of the -K option with the groupadd command?

a) Set group password

b) Create a group with a specific password

c) Set the maximum number of members for the group

d) Set the expiration date for the group

Answer: a) Set group password

Explanation: The -K option with groupadd is used to set a group password in UNIX.


11. Which command is used to change the primary group of a user in UNIX?

a) usermod

b) changegroup

c) primarygroup

d) setgroup

Answer: a) usermod

Explanation: The usermod command is used to change the primary group of a user in UNIX.


12. What is the purpose of the -n option with the groupmod command?

a) Change the group name

b) Change the group ID

c) Change the group owner

d) Change the group description

Answer: a) Change the group name

Explanation: The -n option with groupmod is used to change the name of a group in UNIX.


13. Which command is used to display detailed information about a specific group in UNIX?

a) showgroup

b) getgroup

c) groupinfo

d) getent group

Answer: d) getent group

Explanation: The getent group command displays detailed information about a specific group in UNIX.


14. What is the purpose of the -o option with the groupadd command?

a) Allow the use of non-unique GIDs

b) Set the group owner

c) Set the group description

d) Add users to the group

Answer: a) Allow the use of non-unique GIDs

Explanation: The -o option with groupadd allows the use of non-unique GIDs in UNIX.


15. Which command is used to add an existing user to an existing group in UNIX?

a) useradd

b) adduser

c) usermod

d) usergrp

Answer: c) usermod

Explanation: The usermod command is used to add an existing user to an existing group in UNIX.


16. What is the purpose of the -p option with the groupmod command?

a) Change the group password

b) Change the group ID

c) Change the group owner

d) Change the group description

Answer: a) Change the group password

Explanation: The -p option with groupmod is used to change the password of a group in UNIX.


17. Which command is used to change the password of a group in UNIX?

a) chgrp

b) passwd

c) setgroup

d) changegroup

Answer: b) passwd

Explanation: The passwd command is used to change the password of a group in UNIX.


18. What is the purpose of the -P option with the groupmod command?

a) Set the group password

b) Set the expiration date for the group

c) Set the maximum number of members for the group

d) Set the group owner

Answer: b) 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.


19. Which command is used to display the members of a specific group in UNIX?

a) showgroup

b) getgroup

c) members

d) getent group

Answer: d) getent group

Explanation: The getent group command displays the members of a specific group in UNIX.


20. What is the purpose of the -R option with the groupadd command?

a) Set the group owner

b) Set the group password

c) Set the default group

d) Set the group ID range

Answer: d) 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 remove a user from a group in UNIX?

a) userdel

b) deluser

c) usermod

d) usergrp

Answer: c) usermod

Explanation: The usermod command is used to remove a user from a group in UNIX.


22. What is the purpose of the -r option with the groupadd command?

a) Set the group owner

b) Remove the group’s directory

c) Set the default group

d) Set the group ID range

Answer: b) Remove the group’s directory

Explanation: The -r option with groupadd removes the group’s directory along with the group in UNIX.


23. 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.


24. What is the purpose of the -E 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 -E option with groupmod is used to change the description of a group in UNIX.


25. Which command is used to list all users belonging to a specific group in UNIX?

a) listgroup

b) showgroup

c) getent group

d) getent passwd

Answer: c) getent group

Explanation: The getent group command lists all users belonging to a specific group in UNIX.


26. Which command is used to display the primary group of a user in UNIX?

a) id

b) primarygroup

c) usergroup

d) showgroup

Answer: a) id

Explanation: The id command is used to display user and group information, including the primary group, in UNIX.


27. What is the purpose of the -o option with the groupmod command?

a) Change the group password

b) Allow non-unique GIDs

c) Change the group owner

d) Set the expiration date for the group

Answer: b) Allow non-unique GIDs

Explanation: The -o option with groupmod allows non-unique GIDs (Group IDs) in UNIX.


28. Which command is used to list all groups a user is a member of in UNIX?

a) showgroups

b) listgroups

c) usergroups

d) groups

Answer: d) groups

Explanation: The groups command lists all groups a user is a member of in UNIX.


29. What is the purpose of the -K option with the groupmod command?

a) Change the group password

b) Set the maximum number of members for the group

c) Set the expiration date for the group

d) Set the default group

Answer: b) Set the maximum number of members for the group

Explanation: The -K option with groupmod sets the maximum number of members for the group in UNIX.


30. Which command is used to display the group ID (GID) of a specific group in UNIX?

a) id

b) getent group

c) showgroup

d) groupid

Answer: b) getent group

Explanation: The getent group command displays the group ID (GID) of a specific group in UNIX.


31. What is the purpose of the -p option with the groupdel command?

a) Remove the group’s directory

b) Prompt for confirmation before deletion

c) Remove all users from the group before deletion

d) Remove the group password

Answer: d) Remove the group password

Explanation: The -p option with groupdel removes the group password in UNIX.


32. Which command is used to change the group owner of a directory and its contents recursively in UNIX?

a) chown

b) chgrp

c) setgroup

d) changegroup

Answer: a) chown

Explanation: The chown command is used to change the group owner of a directory and its contents recursively in UNIX.


33. What is the purpose of the -n 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: d) Change the group name

Explanation: The -n option with groupdel changes the group name before deletion in UNIX.


34. Which command is used to change the group ID (GID) of a group in UNIX?

a) changegid

b) setgid

c) groupmod

d) modifygid

Answer: c) groupmod

Explanation: The groupmod command is used to change the group ID (GID) of a group in UNIX.


35. What is the purpose of the -g option with the groupmod command?

a) Change the group name

b) Change the group ID

c) Change the group owner

d) Add users to the group

Answer: b) Change the group ID

Explanation: The -g option with groupmod changes the group ID (GID) of a group in UNIX.


36. Which command is used to list all users on the system along with their primary group in UNIX?

a) getent passwd

b) listusers

c) showusers

d) getent group

Answer: a) getent passwd

Explanation: The getent passwd command lists all users on the system along with their primary group in UNIX.


37. What is the purpose of the -i option with the groupmod command?

a) Change the group ID

b) Set the expiration date for the group

c) Set the maximum number of members for the group

d) Prompt for confirmation before modification

Answer: d) Prompt for confirmation before modification

Explanation: The -i option with groupmod prompts for confirmation before modifying a group in UNIX.


38. Which command is used to change the group membership of a user in UNIX?

a) setgroup

b) changegroup

c) usermod

d) addgroup

Answer: c) usermod

Explanation: The usermod command is used to change the group membership of a user in UNIX.


39. What is the purpose of the -R 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) Remove all users from the group before deletion

Answer: a) Remove the group’s directory

Explanation: The -R option with groupdel removes the group’s directory along with the group in UNIX.


40. Which command is used to change the group password in UNIX?

a) passwd

b) chgrp

c) groupmod

d) setgroup

Answer: a) passwd

Explanation: The passwd command is used to change the group password in UNIX.


41. What is the purpose of the -M option with the groupmod command?

a) Change the group name

b) Set the maximum number of members for the group

c) Set the group password

d) Add or remove users from the group

Answer: d) 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.


42. Which command is used to display the group owner of a file in UNIX?

a) ls

b) getent group

c) showgroup

d) stat

Answer: d) stat

Explanation: The stat command is used to display the group owner of a file in UNIX.


43. What is the purpose of the -f option with the groupmod command?

a) Set the group password

b) Set the expiration date for the group

c) Set the maximum number of members for the group

d) Forcefully modify the group

Answer: d) Forcefully modify the group

Explanation: The -f option with groupmod forcefully modifies the group in UNIX.


44. Which command is used to change the group owner of a symbolic link in UNIX?

a) chown

b) chgrp

c) changegroup

d) setgroup

Answer: b) chgrp

Explanation: The chgrp command is used to change the group owner of a symbolic link in UNIX.


45. What is the purpose of the -l option with the groupmod command?

a) Set the group ID

b) Set the expiration date for the group

c) Change the group name

d) Change the group description

Answer: d) Change the group description

Explanation: The -l option with groupmod is used to change the group description in UNIX.


46. Which command is used to list all members of a specific group in UNIX?

a) listmembers

b) getent group

c) showmembers

d) members

Answer: b) getent group

Explanation: The getent group command lists all members of a specific group in UNIX.


47. What is the purpose of the -N option with the groupadd command?

a) Set the group password

b) Set the expiration date for the group

c) Set the maximum number of members for the group

d) Prevent the creation of a group with the same name as an existing user

Answer: d) 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.


48. Which command is used to change the primary group of a file in UNIX?

a) chown

b) chgrp

c) setgroup

d) changegroup

Answer: a) chown

Explanation: The chown command is used to change the primary group of a file in UNIX.


49. What is the purpose of the -n option with the groupmod command?

a) Change the group ID

b) Set the expiration date for the group

c) Change the group name

d) Change the group owner

Answer: c) Change the group name

Explanation: The -n option with groupmod changes the name of a group in UNIX.


50. 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.

Related Articles

Linux MCQ

Welcome to Linux Multiple Choice Questions (MCQ) Section Embark on a journey through the world of...