As administrator, change report.txt's owner to alice while keeping its group.
Which command is appropriate?
chown OWNER FILE changes only the owner when the group component is omitted. Use OWNER:GROUP to change both.
Detailed explanation
chgrp alice report.txtIncorrect. chgrp changes the group.
Incorrect. chgrp changes the group.
chmod alice report.txtIncorrect. chmod changes mode bits.
Incorrect. chmod changes mode bits.
chown :alice report.txtIncorrect. chown :alice changes the group to alice.
Incorrect. chown :alice changes the group to alice.
chown alice report.txtCorrect. chown alice report.txt changes only the owner.
Correct. chown alice report.txt changes only the owner.
Try it yourself
An example you can run in a temporary verification environment.
chown --help | sed -n '1,3p'Expected result
chownの使用法。実ファイルの所有者は変更しないKey points
- chown changes owner
- Omitting group preserves it
- Appropriate privileges are required
Notes
- Environment: GNU coreutils 9.x / helpのみ
- 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.