Keep notes.txt's owner and change its owning group to writers.
Use the group-specific command.
Which command is appropriate?
chgrp GROUP FILE changes only the owning group. chown :GROUP FILE is an equivalent form on GNU systems.
Detailed explanation
chown writers notes.txtIncorrect. chown writers notes.txt treats writers as an owner name.
Incorrect. chown writers notes.txt treats writers as an owner name.
chmod writers notes.txtIncorrect. chmod changes permissions, not the owning group.
Incorrect. chmod changes permissions, not the owning group.
chgrp writers notes.txtCorrect. chgrp writers notes.txt changes only the group.
Correct. chgrp writers notes.txt changes only the group.
groups writers notes.txtIncorrect. groups displays group membership and does not change file ownership.
Incorrect. groups displays group membership and does not change file ownership.
Try it yourself
An example you can run in a temporary verification environment.
chgrp --helpExpected result
chgrp [OPTION]... GROUP FILE...Key points
- chgrp is group-only
- The owner is preserved
- Specify GROUP first
Notes
- Environment: GNU coreutils 9.x
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.