LX0-104 · Question #368
Which command will set the user.author attribute on the file afile.txt?
The correct answer is B. setfattr n user.author v "A. Author" afile.txt. This question requires knowing the correct command syntax to set a user-defined extended attribute with a specific value using setfattr.
Question
Options
- Asetfattr user.author:"A. Author" afile.txt
- Bsetfattr n user.author v "A. Author" afile.txt
- Csetfattr user.author="A. Author" afile.txt
- Dsetfattr a user.author="A. Author" afile.txt
How the community answered
(29 responses)- A3% (1)
- B86% (25)
- C7% (2)
- D3% (1)
Why each option
This question requires knowing the correct command syntax to set a user-defined extended attribute with a specific value using `setfattr`.
This syntax is incorrect as `setfattr` requires `-n` for the attribute name and `-v` for the value.
The `setfattr` command uses the `-n` (or `n`) option to specify the attribute name and the `-v` (or `v`) option to specify its value. The format `setfattr n user.author v "A. Author" afile.txt` correctly applies the attribute `user.author` with the value "A. Author" to `afile.txt`.
This syntax is incorrect for `setfattr`; it expects separate options for the attribute name and value.
The `-a` option is for appending to the end of a value, which is generally not supported for attributes like this, and the command is still missing the `-n` and `-v` flags required for setting an attribute value.
Concept tested: Setting Linux Extended Attributes
Source: https://linux.die.net/man/1/setfattr
Topics
Community Discussion
No community discussion yet for this question.