nerdexam
CompTIA

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.

Administrative Tasks

Question

Which command will set the user.author attribute on the file afile.txt?

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)
  • A
    3% (1)
  • B
    86% (25)
  • C
    7% (2)
  • D
    3% (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`.

Asetfattr user.author:"A. Author" afile.txt

This syntax is incorrect as `setfattr` requires `-n` for the attribute name and `-v` for the value.

Bsetfattr n user.author v "A. Author" afile.txtCorrect

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`.

Csetfattr user.author="A. Author" afile.txt

This syntax is incorrect for `setfattr`; it expects separate options for the attribute name and value.

Dsetfattr a user.author="A. Author" afile.txt

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

#Extended Attributes#setfattr#xattrs

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice