LFCS · Question #790
Which of the following chown commands will change the ownership to foo and the group to bar on a file named biglist?
The correct answer is C. chown foo:bar biglist. The chown command uses the owner:group syntax to simultaneously change both the user owner and the group owner of a file.
Question
Options
- Achown foo/bar biglist
- Bchown -u foo -g bar biglist
- Cchown foo:bar biglist
- Dchown --user foo --group bar biglist
How the community answered
(26 responses)- A4% (1)
- B4% (1)
- C92% (24)
Why each option
The `chown` command uses the `owner:group` syntax to simultaneously change both the user owner and the group owner of a file.
The `/` character is not used as a separator for owner and group in the `chown` command syntax.
The `-u` and `-g` options are not valid or standard `chown` options for specifying user and group ownership.
The standard `chown` syntax to change both the user owner and the group owner of a file is `chown user:group file`, making `chown foo:bar biglist` the correct command.
The `--user` and `--group` options are not valid or standard `chown` options for specifying user and group ownership.
Concept tested: Linux file ownership and group modification
Source: https://man7.org/linux/man-pages/man1/chown.1.html
Topics
Community Discussion
No community discussion yet for this question.