010-150 · Question #72
Which of the following will change the group that is associated with a file?
The correct answer is C. chown. The chown command changes file ownership and can also change the associated group using the 'chown user:group' or 'chown :group' syntax.
Question
Which of the following will change the group that is associated with a file?
Options
- Achmod
- Bchmod -w
- Cchown
- Dls -g
How the community answered
(43 responses)- A12% (5)
- B5% (2)
- C81% (35)
- D2% (1)
Why each option
The chown command changes file ownership and can also change the associated group using the 'chown user:group' or 'chown :group' syntax.
chmod changes permission bits (read, write, execute) on a file but does not affect which user or group owns it.
'chmod -w' removes write permission from a file's permission bits and has no effect on group ownership.
chown (change owner) accepts an optional group component in the form 'chown owner:group file' or 'chown :group file', allowing the file's associated group to be changed. While chgrp is the dedicated group-change command, chown is the answer here as it is the only listed command capable of changing group association.
'ls -g' is a listing flag that displays group information in output but does not modify any file attributes.
Concept tested: Changing file group ownership with chown
Source: https://www.man7.org/linux/man-pages/man1/chown.1.html
Topics
Community Discussion
No community discussion yet for this question.