LX0-103 · Question #104
Which command will print out the attributes of the file foobar?
The correct answer is B. Isattr foobar. The lsattr command displays the extended filesystem attributes (such as immutable or append-only flags) of a specified file.
Question
Which command will print out the attributes of the file foobar?
Options
- AIs-attrfoobar
- BIsattr foobar
- Cprintattr foobar
- Dfileattr foobar
How the community answered
(26 responses)- B92% (24)
- C4% (1)
- D4% (1)
Why each option
The `lsattr` command displays the extended filesystem attributes (such as immutable or append-only flags) of a specified file.
`ls-attrfoobar` is malformed - the tokens are concatenated without spaces, and the `ls` command has no `-attr` option for reading inode-level filesystem attributes.
`lsattr foobar` (shown as 'Isattr' due to a font rendering artifact where lowercase 'l' resembles 'I') is the standard Linux command for displaying inode-level filesystem attribute flags set by `chattr`, such as immutable (+i), append-only (+a), and no-dump (+d). It reads these flags directly from the filesystem and prints them for the specified file.
`printattr` is not a standard Linux command and does not exist in common distributions for displaying filesystem-level inode attributes.
`fileattr` is not a standard Linux utility; the correct command for listing inode-level filesystem attributes assigned by `chattr` is `lsattr`.
Concept tested: Linux lsattr command for displaying inode filesystem attributes
Source: https://man7.org/linux/man-pages/man1/lsattr.1.html
Topics
Community Discussion
No community discussion yet for this question.