LFCS · Question #370
Which command will list all of the extended attributes on the file afile.txt along with the values?
The correct answer is D. getfattr dump afile.txt. The getfattr command is used to retrieve extended attributes, and a specific option is required to display all attribute names along with their values.
Question
Options
- Agetfattr all afile.txt
- Bgetfattr afile.txt
- Cgetfattr list afile.txt
- Dgetfattr dump afile.txt
How the community answered
(29 responses)- A3% (1)
- B7% (2)
- D90% (26)
Why each option
The `getfattr` command is used to retrieve extended attributes, and a specific option is required to display all attribute names along with their values.
The `all` keyword is not a valid option for `getfattr` to list all attributes with their values; the correct option for this purpose is `--dump` or `--all-known`.
Running `getfattr` without any specific options typically does not display all attribute names and values; it usually requires `-d` or `-n` to specify what to retrieve.
The `list` keyword is not a recognized option for the `getfattr` command to display attributes and their values.
The `getfattr --dump` (or its shorthand `-d`) option is specifically designed to list all extended attribute names and their associated values for the specified file, making it the correct command.
Concept tested: Listing Linux Extended Attributes (getfattr)
Source: https://linux.die.net/man/1/getfattr
Topics
Community Discussion
No community discussion yet for this question.